I am running an android application with Fabric installed for Crashlytics. For most of my users every thing works without a problem, however some users (All of which are running android Pie, and using a Google phone Pixel 2, Pixel 3) are getting a crash caused by Fabric itself it seems to have something to do with accessing SharedPrefs, see log below.
java.lang.RuntimeException:
at android.app.ActivityThread.handleBindApplication
(ActivityThread.java:5925)
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 android.app.ContextImpl.getSharedPreferences (ContextImpl.java:419)
at android.app.ContextImpl.getSharedPreferences (ContextImpl.java:404)
at android.content.ContextWrapper.getSharedPreferences (ContextWrapper.java:174)
at io.fabric.sdk.android.services.persistence.PreferenceStoreImpl.<init> (PreferenceStoreImpl.java:39)
at io.fabric.sdk.android.services.common.AdvertisingInfoProvider.<init> (AdvertisingInfoProvider.java:37)
at io.fabric.sdk.android.services.common.IdManager.<init> (IdManager.java:114)
at io.fabric.sdk.android.Fabric.with (Fabric.java:2288)
at com.aaronbrecher.neverlate.NeverLateApp.onCreate (NeverLateApp.java:21)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1154)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5920)
This exception occurs, when storage is protected and application is started via LOCKED_BOOT_COMPLETED broadcast.
Code from android.app.ContextImpl:
if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.O) {
if (isCredentialProtectedStorage()
&& !getSystemService(UserManager.class)
.isUserUnlockingOrUnlocked(UserHandle.myUserId())) {
throw new IllegalStateException("SharedPreferences in credential encrypted "
+ "storage are not available until after user is unlocked");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With