我正在运行一个安装了Crashlytics的Android应用程序。对于大多数用户来说,一切都没有问题,然而一些用户(所有这些用户都在运行Android Pie,并使用Google手机Pixel 2、Pixel 3)会遇到由Fabric本身引起的崩溃,似乎与访问SharedPrefs有关,见下面的日志。
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)