java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked

戏子无情 提交于 2020-06-28 06:22:55

问题


Crashes are not getting logged in cashlytics on Google Pixel devices(OS 9.0-pie) and Playstore reports ANR&Crashes as java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked

It is happening while initializing Fabric.with(this, new Crashlytics()), It is also observed that the IllegalStateException is thrown on restart of device and application is registered for LOCKED_BOOT_COMPLETED & BOOT_COMPLETED broadcast intents

E/AndroidRuntime: FATAL EXCEPTION: main
   Process: com.connect, PID: 2328
   java.lang.RuntimeException: Unable to create application com..common.app.AppApplication: java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked
       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

Has anyone faced the similar issue. Can anyone help in solving this issue?


回答1:


I haven't run into the issue myself but here's an article that talks about supporting Direct Boot mode.

https://developer.android.com/training/articles/direct-boot

Here's also a Github link from Google showing how you can access a device's encrypted storage. In the AlarmStorage class.

https://github.com/googlesamples/android-DirectBoot/



来源:https://stackoverflow.com/questions/55480988/java-lang-illegalstateexception-sharedpreferences-in-credential-encrypted-stora

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!