I found this error in my Crashlytics and it seems to only crash for users with the Android Nougat preview version.
Failure to load the application at startup (main activity).
Stacktrace
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
It looks like Android Nougat no longer supports some of the system colors that I use in my application? But I donβt know exactly how to fix it.
Edit
So, I found the resource with identifier 0x7f020057 in the R file, and this is it:
public static final int background_splash_gradient = 0x7f020057;
I checked where I use it, and here it is:
<style name="StartingWindowTheme" parent="AppTheme"> <item name="android:windowBackground">@drawable/background_splash_gradient</item> <item name="android:colorBackground">@drawable/background_splash_gradient</item> </style>
And this is background_splash_gradiend xml file:
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="135" android:endColor="#00d49e" android:startColor="#00bcd4"/> </shape>
I still donβt know why this causes problems in Nougat. I tried to remove the "StartWindowTheme" style and the application now works, it will no longer work. But I need a better fix than that.
Edit 2
So, I tried to delete this line:
<item name="android:colorBackground">@drawable/background_splash_gradient</item>
And it works. android:colorBackground seems to be the problem.
TEMPORARY CORRECTION
Since the problem in the line mentioned above is only on Nougat, I created the values-v24 and deleted the line there. Now the application is working on Nougat, but I would appreciate a better solution.