Fabric causing crash for Android Pie users
Asked Answered
D

1

7

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)
Djokjakarta answered 10/12, 2018 at 2:19 Comment(0)
N
2

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");
   }
}   
Ninny answered 30/1, 2019 at 10:37 Comment(3)
Thanks for the answer it sounds like that may be my issue, the only question is I am not doing anything on that broadcast... So why would my app be launched then?Djokjakarta
Maybe it is not problem in starting your application at boot, maybe problem is with encripted strorage in user. And when user has locked device, FC occurs.Ninny
@AaronBrecher, did your issue resolved? I am also getting the same crash log on google play store.Bacchic

© 2022 - 2024 — McMap. All rights reserved.