我刚刚迁移到Firebase Analytics 9.0.0,当尝试在模拟器api10 / x86上启动应用时,服务会抛出以下异常。任何想法如何解决这个问题?
05-23 15:36:44.371 1280-1280/? E/AndroidRuntime: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.szyk.myheart/com.szyk.myheart.MyHeartActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3683) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.google.android.gms.flags.impl.FlagProviderImpl.getBooleanFlagValue(Unknown Source) at com.google.android.gms.internal.zzsd$zza.zzb(Unknown Source) at com.google.android.gms.internal.zzsd$zza.zza(Unknown Source) at com.google.android.gms.internal.zzsf.zzb(Unknown Source) at com.google.android.gms.internal.zzsd.get(Unknown Source) at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source) at com.google.firebase.crash.FirebaseCrash.zzOW(Unknown Source) at com.google.firebase.crash.FirebaseCrash.log(Unknown Source) at com.szyk.extras.activities.UniversalActionBarActivity.onCreate(UniversalActionBarActivity.java:46) at com.szyk.myheart.MyHeartActivity.onCreate(MyHeartActivity.java:99) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3683) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method)
代码只不过是以下活动:
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FirebaseCrash.log("onCreate: " + getClass().getSimpleName());
}
答案 0 :(得分:1)
不幸的是,在没有Play服务的设备或模拟器上使用Firebase不是受支持的用例。崩溃报告将无法初始化,并且当应用程序启动时,您将在logcat中看到相应的消息。但是,如果在初始化失败后调用方法时也看到崩溃,那么这似乎是一个我们应该纠正的问题。
听起来你可以通过压制异常来做你最好的事情,但我宁愿不让你经历这一点,所以我会把它作为反馈给团队。
答案 1 :(得分:0)
对Doug提到的内容进行小幅修改。非播放设备不支持Firebase崩溃报告。特别是Firebase Analytics和其他一些Firebase产品确实支持非播放设备。