问题
android.content.res.Resources$NotFoundException
android.content.res.ResourcesImpl.getResourcePackageName
After upgrading Crashlytics from 2.6.6 to 2.9.1 we have started to notice a crash in Google Play Console.
This crash happens before Crashlytics is initialized so it is never reported in Crashlytics:
java.lang.RuntimeException:
at android.app.ActivityThread.installProvider (ActivityThread.java:6423)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:6012)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5951)
at android.app.ActivityThread.-wrap3 (ActivityThread.java)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1710)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6776)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: android.content.res.Resources$NotFoundException:
at android.content.res.ResourcesImpl.getResourcePackageName (ResourcesImpl.java:248)
at android.content.res.Resources.getResourcePackageName (Resources.java:2785)
at io.fabric.sdk.android.services.common.CommonUtils.getResourcePackageName (CommonUtils.java:767)
at io.fabric.sdk.android.services.common.CommonUtils.getResourcesIdentifier (CommonUtils.java:517)
at io.fabric.sdk.android.services.common.CommonUtils.getBooleanResourceValue (CommonUtils.java:498)
at io.fabric.sdk.android.services.common.FirebaseInfo.isFirebaseCrashlyticsEnabled (FirebaseInfo.java:52)
at com.crashlytics.android.CrashlyticsInitProvider.shouldInitializeFabric (CrashlyticsInitProvider.java:73)
at com.crashlytics.android.CrashlyticsInitProvider.onCreate (CrashlyticsInitProvider.java:25)
at android.content.ContentProvider.attachInfo (ContentProvider.java:1759)
at android.content.ContentProvider.attachInfo (ContentProvider.java:1734)
at android.app.ActivityThread.installProvider (ActivityThread.java:6420)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:6012)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5951)
at android.app.ActivityThread.-wrap3 (ActivityThread.java)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1710)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6776)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
The crash doesn't impact too many users, but they can't start the app. I.e. we have this ratio:
- Impacted users: 93
- Reports total: 4,221
回答1:
It was happening for me as well. I couldn't reproduce it but after analyzing Crashlytics log history I realized it started happening after I moved to app bundle. So I moved back to apk and now I am not getting these issue anymore.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx/com.xxx.xx.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f0700e7
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2733)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6146)
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)
来源:https://stackoverflow.com/questions/49552465/android-fabric-crashlytics-crashing-with-resourcesnotfoundexception-on-app-laun