title: Can't find ColorStateList from drawable resource ID only on Android Nougat
body: <p>I have found this error in my Crashlytics, and it seems like it's only crashing for users with preview version of Android Nougat.</p>
  
  <p>App crashes on startup (Main Activity).</p>
  
  <p><strong>Stacktrace</strong></p>
  
  <pre><code>Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.domain/com.my.domain.activities.MainActivity}: android.content.res.Resources$NotFoundException: Can't find ColorStateList from drawable resource ID #0x7f020057
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
     at android.app.ActivityThread.-wrap12(ActivityThread.java)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:154)
     at android.app.ActivityThread.main(ActivityThread.java:6077)
     at java.lang.reflect.Method.invoke(Method.java)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
  Caused by android.content.res.Resources$NotFoundException: Can't find ColorStateList from drawable resource ID #0x7f020057
     at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:840)
     at android.content.res.Resources.loadColorStateList(Resources.java:998)
     at android.content.res.TypedArray.getColor(TypedArray.java:447)
     at android.app.Activity.onApplyThemeResource(Activity.java:4039)
     at android.view.ContextThemeWrapper.initializeTheme(ContextThemeWrapper.java:198)
     at android.view.ContextThemeWrapper.setTheme(ContextThemeWrapper.java:140)
     at android.app.Activity.setTheme(Activity.java:4009)
     at android.support.v7.app.AppCompatActivity.setTheme(AppCompatActivity.java:90)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2592)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
     at android.app.ActivityThread.-wrap12(ActivityThread.java)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:154)
     at android.app.ActivityThread.main(ActivityThread.java:6077)
     at java.lang.reflect.Method.invoke(Method.java)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
  </code></pre>
  
  <p>It looks like Android Nougat no longer supports some kind of system colors that I'm using in my app? But I don't know exactly how to fix it.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>So I found the resource with ID 0x7f020057 in my <strong>R</strong> file and this is it:</p>
  
  <blockquote>
    <p>public static final int background_splash_gradient=0x7f020057;</p>
  </blockquote>
  
  <p>I checked where I am using it and here it is:</p>
  
  <pre><code>&lt;style name="StartingWindowTheme" parent="AppTheme"&gt;
      &lt;item name="android:windowBackground"&gt;@drawable/background_splash_gradient&lt;/item&gt;
      &lt;item name="android:colorBackground"&gt;@drawable/background_splash_gradient&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>And this is the <em>background_splash_gradiend</em> xml file:</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;gradient
      android:angle="135"
      android:endColor="#00d49e"
      android:startColor="#00bcd4"/&gt;
  
  &lt;/shape&gt;
  </code></pre>
  
  <p>I still don't know why this is causing issues on Nougat. I tried removing the "StartingWindowTheme" style and app now works, it no longer crashes. But I need a better fix than that.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>So I tried to remove this line:</p>
  
  <pre><code>&lt;item name="android:colorBackground"&gt;@drawable/background_splash_gradient&lt;/item&gt;
  </code></pre>
  
  <p>And it works. Seems like <code>android:colorBackground</code> is the issue.</p>
  
  <p><strong>TEMPORARY FIX</strong></p>
  
  <p>Since the problem is in the line mentioned above, only on Nougat, I have created a <code>values-v24</code> folder and removed the line there. App works on Nougat now, but I would appreciate a better solution.</p>