Firebase crashing on some devices with java.lang.IllegalStateException
- Android Studio version: 2020.3.1 Patch 4
- Firebase Component: crashlytics
- Component version:
- com.google.firebase:firebase-crashlytics-gradle:2.8.1
- com.google.firebase:firebase-bom:29.0.1
Describe the problem I'm receiving several crash reports from the google play console with these two sets of stack traces:
java.lang.RuntimeException:
at android.app.ActivityThread.installProvider (ActivityThread.java:6445)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:5987)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5902)
at android.app.ActivityThread.access$1100 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1656)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:6718)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException:
at com.google.firebase.crashlytics.internal.persistence.FileStore.prepareBaseDir (FileStore.java:188)
at com.google.firebase.crashlytics.internal.persistence.FileStore.<init> (FileStore.java:66)
at com.google.firebase.crashlytics.internal.persistence.FileStore.$r8$init$bridge (FileStore.java)
at com.google.firebase.crashlytics.FirebaseCrashlytics.init (FirebaseCrashlytics.java:75)
at com.google.firebase.crashlytics.CrashlyticsRegistrar.buildCrashlytics (CrashlyticsRegistrar.java:57)
at com.google.firebase.crashlytics.CrashlyticsRegistrar$$InternalSyntheticLambda$2$db162bb9be36f9206ef3c77773d22791204d3cb6279c7815312c3bc51d3b6568$0.create$bridge (CrashlyticsRegistrar.java)
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0 (ComponentRuntime.java:132)
at com.google.firebase.components.ComponentRuntime$$InternalSyntheticLambda$1$562ccfbab29457946f69b904d7c620216b88cbd0fd784cee32e00ed2dcd3a60c$0.get (ComponentRuntime.java)
at com.google.firebase.components.Lazy.get (Lazy.java:53)
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents (ComponentRuntime.java:291)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents (ComponentRuntime.java:281)
at com.google.firebase.FirebaseApp.initializeAllApis (FirebaseApp.java:584)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:303)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate (FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo (ContentProvider.java:1920)
at android.content.ContentProvider.attachInfo (ContentProvider.java:1895)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo (FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider (ActivityThread.java:6440)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:5987)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5902)
at android.app.ActivityThread.access$1100 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1656)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:6718)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
java.lang.RuntimeException:
at android.app.ActivityThread.installProvider (ActivityThread.java:6445)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:5987)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5902)
at android.app.ActivityThread.access$1100 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1656)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:6718)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException:
at com.google.firebase.crashlytics.internal.persistence.FileStore.prepareBaseDir (FileStore.java:188)
at com.google.firebase.crashlytics.internal.persistence.FileStore.<init> (FileStore.java:66)
at com.google.firebase.crashlytics.internal.persistence.FileStore.$r8$init$bridge (FileStore.java)
at com.google.firebase.crashlytics.ndk.FirebaseCrashlyticsNdk.create (FirebaseCrashlyticsNdk.java:33)
at com.google.firebase.crashlytics.ndk.CrashlyticsNdkRegistrar.buildCrashlyticsNdk (CrashlyticsNdkRegistrar.java:48)
at com.google.firebase.crashlytics.CrashlyticsRegistrar$$InternalSyntheticLambda$2$db162bb9be36f9206ef3c77773d22791204d3cb6279c7815312c3bc51d3b6568$0.create$bridge (CrashlyticsRegistrar.java)
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0 (ComponentRuntime.java:132)
at com.google.firebase.components.ComponentRuntime$$InternalSyntheticLambda$1$562ccfbab29457946f69b904d7c620216b88cbd0fd784cee32e00ed2dcd3a60c$0.get (ComponentRuntime.java)
at com.google.firebase.components.Lazy.get (Lazy.java:53)
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents (ComponentRuntime.java:291)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents (ComponentRuntime.java:281)
at com.google.firebase.FirebaseApp.initializeAllApis (FirebaseApp.java:584)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:303)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate (FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo (ContentProvider.java:1920)
at android.content.ContentProvider.attachInfo (ContentProvider.java:1895)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo (FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider (ActivityThread.java:6440)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:5987)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5902)
at android.app.ActivityThread.access$1100 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1656)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:6718)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Steps to reproduce:
Unknown, this does seem to primarily happen on Android TV, these are the devices where I see this: Xiaomi MiBox S LGE K51S Sony BRAVIA 4K GB Xiaomi Mi TV Stick THEHAM UHD Android TV Sony BRAVIA 4K UR3 Sony BRAVIA VH2 Sony BRAVIA 4K UR2 NVIDIA SHIELD Android TV Motorola moto e6 play Nokia 1.3
The crash rate seems to be somewhat low.
Relevant Code: I'm not sure what to put here, since this seems to be happening during crashlytics initialization, here is the associated open source project though:
https://github.com/fzurita/mupen64plus-ae/tree/fz-master-v299
Hi @fzurita, thanks for reporting. We'll try to investigate this, however since the crash rate is somewhat low, this might be a race condition, as a result, reproducing this issue might be difficult. In the meantime, let's keep this ticket open and see if our engineers might have some idea what's causing this.
Just an update. On the " Xiaomi MiBox S" device, it appears to be very reproducible given that I have 3 impacted users which have 15 crashes.
Hi @fzurita, I'm having problem determining where the issue could be. Could you provide us with a minimal reproducible example with the issue? Thanks
Just to clarify, I don't have any devices that are running into this issue, I only know based on crash reports from the play store.
After taking that into account, it should not be very difficult to reproduce this if you have one of the affected devices, the "Xiaomi MiBox S" seems to be badly affected. You can download the app from the play store here: https://play.google.com/store/apps/details?id=org.mupen64plusae.v3.fzurita
Or if you need to the full source code, you can build it yourself by importing this project into Android studio: https://github.com/fzurita/mupen64plus-ae/tree/fz-master-v299
To build that project, you will need a google-services.json file that I don't include in GitHub which is needed by firebase.
Hi @fzurita, thanks for the extra details. I was able to build the project with the GitHub link, however due to the lack of devices, I'm also unable to reproduce this issue. While I try to investigate this further, may I ask if there is a specific SDK version this issue is affecting?
Here is the distribution for the two versions of the crash:

It seems to be associated with Android 9, 10, 11 and Android TV.
First screenshot belongs to the first stack trace, second screenshot belong to the second stack trace.
How to resolved this issue? I have the same issue
We're taking a look at this right now, and I'll update this issue soon.
Hello @mrober, you can try reproduce this bug also on Samsung devices

It seems that mkdirs return false, then you throw an exception. So how can I catch this exception?

Hi folks, the fix is available in Crashlytics 18.2.9. It appears it was not mentioned in the release notes.
Hi all, since this fix has been fixed and merged. I'll be closing this issue now. Thanks!
Still happening for some reason only on Samsung Galaxy A71, using 18.2.9.
java.lang.RuntimeException:
at android.app.ActivityThread.installProvider (ActivityThread.java:7769)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:7309)
at android.app.ActivityThread.handleMakeApplication (ActivityThread.java:7166)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7134)
at android.app.ActivityThread.access$1500 (ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2102)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8167)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)
Caused by: java.lang.IllegalStateException:
at com.google.firebase.crashlytics.internal.persistence.FileStore.prepareBaseDir (FileStore.java:188)
at com.google.firebase.crashlytics.internal.persistence.FileStore.<init> (FileStore.java:66)
at com.google.firebase.crashlytics.FirebaseCrashlytics.init (FirebaseCrashlytics.java:75)
at com.google.firebase.crashlytics.CrashlyticsRegistrar.buildCrashlytics (CrashlyticsRegistrar.java:57)
at com.google.firebase.crashlytics.CrashlyticsRegistrar.$r8$lambda$Pfd5XmDCFzNyAT9o9H6rDnTBQE4 (CrashlyticsRegistrar.java)
at com.google.firebase.components.Component$$InternalSyntheticLambda$0$7450934bcbce30e671475a5c1f1725e2343c78b4f44dfce9ecdf4bfe4e41b4bf$0.create$bridge (Component.java:17)
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0 (ComponentRuntime.java:132)
at com.google.firebase.components.ComponentRuntime.$r8$lambda$4FqOW9eOQsvFYo-HpMfxCOnPQr0 (ComponentRuntime.java)
at com.google.firebase.components.ComponentRuntime$$InternalSyntheticLambda$0$562ccfbab29457946f69b904d7c620216b88cbd0fd784cee32e00ed2dcd3a60c$0.get (ComponentRuntime.java:4)
at com.google.firebase.components.Lazy.get (Lazy.java:53)
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents (ComponentRuntime.java:291)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents (ComponentRuntime.java:281)
at com.google.firebase.FirebaseApp.initializeAllApis (FirebaseApp.java:594)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:305)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:269)
at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:254)
at com.google.firebase.provider.FirebaseInitProvider.onCreate (FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo (ContentProvider.java:2113)
at android.content.ContentProvider.attachInfo (ContentProvider.java:2087)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo (FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider (ActivityThread.java:7764)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:7309)
at android.app.ActivityThread.handleMakeApplication (ActivityThread.java:7166)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7134)
at android.app.ActivityThread.access$1500 (ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2102)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8167)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)
Still exists.
Unity editor version: 2020.3.22f1 Firebase Unity SDK version: 8.9.0 Source you installed the SDK: .unitypackage Problematic Firebase Component: Cloud Messaging Other Firebase Components in use: Auth, Database, Remote Config Additional SDKs you are using: Facebook, IronSource, Adjust Platform you are using the Unity editor on: Mac Platform you are targeting: Android and iOS Scripting Runtime: IL2CPP
[REQUIRED] Please describe the issue here:
Type java.lang.RuntimeException java.lang.RuntimeException: at android.app.ActivityThread.installProvider (ActivityThread.java:7455) at android.app.ActivityThread.installContentProviders (ActivityThread.java:6991) at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6886) at android.app.ActivityThread.access$1300 (ActivityThread.java:244) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1920) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:223) at android.app.ActivityThread.main (ActivityThread.java:7868) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:981) Caused by: java.lang.IllegalStateException: at com.google.firebase.crashlytics.internal.persistence.FileStore.prepareBaseDir (FileStore.java:188) at com.google.firebase.crashlytics.internal.persistence.FileStore.<init> (FileStore.java:66) at com.google.firebase.crashlytics.FirebaseCrashlytics.init (FirebaseCrashlytics.java:75) at com.google.firebase.crashlytics.CrashlyticsRegistrar.buildCrashlytics (CrashlyticsRegistrar.java:57) at com.google.firebase.crashlytics.CrashlyticsRegistrar.lambda$aBuXIXlTYD2Kajd_VBsZ-5OANwA (Unknown Source) at com.google.firebase.crashlytics.-$$Lambda$CrashlyticsRegistrar$aBuXIXlTYD2Kajd_VBsZ-5OANwA.create (Unknown Source:2) at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$ComponentRuntime (ComponentRuntime.java:132) at com.google.firebase.components.-$$Lambda$ComponentRuntime$CLI-XObGztS2iu7RD22eoA3PpJU.get (Unknown Source:4) at com.google.firebase.components.Lazy.get (Lazy.java:53) at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents (ComponentRuntime.java:291) at com.google.firebase.components.ComponentRuntime.initializeEagerComponents (ComponentRuntime.java:281) at com.google.firebase.FirebaseApp.initializeAllApis (FirebaseApp.java:594) at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:305) at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:269) at com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:254) at com.google.firebase.provider.FirebaseInitProvider.onCreate (FirebaseInitProvider.java:51) at android.content.ContentProvider.attachInfo (ContentProvider.java:2391) at android.content.ContentProvider.attachInfo (ContentProvider.java:2361) at com.google.firebase.provider.FirebaseInitProvider.attachInfo (FirebaseInitProvider.java:45) at android.app.ActivityThread.installProvider (ActivityThread.java:7450)

Reopening since it looks like this issue is still present.
Please try depending on this version specifically, and see if the issue is still present: com.google.firebase:firebase-crashlytics:18.2.10
@mrober Honestly, I would like to get fix without live testing in production)
The issue is fixed in 18.2.10. Sorry for the poor language, I meant "try" to try overriding the Crashlytics version in your dependencies, and see if the issue is fixed to confirm you got that version. Or you can wait for the next BOM and get it that way if it's easier for you. @fdspbsteam
@mrober just to confirm dependencies:
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
and com.google.firebase:firebase-crashlytics:18.2.10
Am I right?
That is right, but this is included in the latest BOM, so there is no need for the override anymore. I am closing this issue.