Fabric 导致 Android Pie 用户崩溃
Fabric causing crash for Android Pie users
我是 运行 一个 android 应用程序,为 Crashlytics 安装了 Fabric。对于我的大多数用户来说,一切都没有问题,但是有些用户(所有用户都是 运行 android 饼图,并使用 Google phone Pixel 2,Pixel 3 ) 正在发生由 Fabric 本身引起的崩溃,它似乎与访问 SharedPrefs 有关,请参阅下面的日志。
java.lang.RuntimeException:
at android.app.ActivityThread.handleBindApplication
(ActivityThread.java:5925)
at android.app.ActivityThread.access00 (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)
当存储受到保护并且应用程序通过 LOCKED_BOOT_COMPLETED 广播启动时,会发生此异常。
来自 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");
}
}
我是 运行 一个 android 应用程序,为 Crashlytics 安装了 Fabric。对于我的大多数用户来说,一切都没有问题,但是有些用户(所有用户都是 运行 android 饼图,并使用 Google phone Pixel 2,Pixel 3 ) 正在发生由 Fabric 本身引起的崩溃,它似乎与访问 SharedPrefs 有关,请参阅下面的日志。
java.lang.RuntimeException:
at android.app.ActivityThread.handleBindApplication
(ActivityThread.java:5925)
at android.app.ActivityThread.access00 (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)
当存储受到保护并且应用程序通过 LOCKED_BOOT_COMPLETED 广播启动时,会发生此异常。
来自 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");
}
}