我的应用crashes
当我将我的应用程序保持在pause
超过15-20 min.
时,我已将用户凭据保留在Shared preference
中。这是由于shared preference
数据被GC清除。任何人都可以建议如何摆脱这个问题?
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: java.lang.reflect.InvocationTargetException
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Native Method)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Method.java:372)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.zza(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.access$1500(ActivityThread.java:151)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.os.Handler.dispatchMessage(Handler.java:102)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.os.Looper.loop(Looper.java:135)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.main(ActivityThread.java:5254)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Native Method)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Method.java:372)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.android.gms.flags.impl.FlagProviderImpl.getBooleanFlagValue(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.android.gms.internal.zzsd$zza.zzb(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.android.gms.internal.zzsd$zza.zza(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.android.gms.internal.zzsf.zzb(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.android.gms.internal.zzsd.get(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Native Method)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Method.java:372)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.zza(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.access$1500(ActivityThread.java:151)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.os.Handler.dispatchMessage(Handler.java:102)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.os.Looper.loop(Looper.java:135)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at android.app.ActivityThread.main(ActivityThread.java:5254)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Native Method)
06-08 05:04:52.913 4128-4128/org.openinfotech.home A/FirebaseApp: at java.lang.reflect.Method.invoke(Method.java:372)
答案 0 :(得分:0)
作为你的logcat异常,我认为你在类中使用布尔值作为数据类型。将布尔值更改为布尔值。因为boolean是原始数据类型,而Boolean是包装布尔值的对象/引用类型。
boolean可以是yes或no ... Boolean可以是yes,no或NULL
希望这会对你有所帮助。