Firebase Crash produces ANR during launch

匿名 (未验证) 提交于 2019-12-03 01:59:02

问题:

Recently I got feedback and also I was able to reproduce it easily on my Nexus 5 with cleared app data. Simply, when adding compile 'com.google.firebase:firebase-crash:9.4.0' only to project dependencies I get following Exception:

09-14 00:47:54.899 3129-3129/com.szyk.myheart E/FirebaseCrash: Failed to initialize crash reporting                                                            java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference                                                                at bol.(:com.google.android.gms.DynamiteModulesC:3201)                                                                at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl.init(:com.google.android.gms.DynamiteModulesC:67)                                                                at bnu.onTransact(:com.google.android.gms.DynamiteModulesC:60)                                                                at android.os.Binder.transact(Binder.java:387)                                                                at com.google.firebase.crash.internal.zzd$zza$zza.zza(Unknown Source)                                                                at com.google.firebase.crash.FirebaseCrash.(Unknown Source)                                                                at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)                                                                at java.lang.reflect.Method.invoke(Native Method)                                                                at com.google.firebase.FirebaseApp.zza(Unknown Source)                                                                at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)                                                                at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)                                                                at com.google.firebase.FirebaseApp.zzek(Unknown Source)                                                                at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)                                                                at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)                                                                at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)                                                                at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)                                                                at android.app.ActivityThread.installProvider(ActivityThread.java:5153)                                                                at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)                                                                at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)                                                                at android.app.ActivityThread.-wrap1(ActivityThread.java)                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)                                                                at android.os.Handler.dispatchMessage(Handler.java:102)                                                                at android.os.Looper.loop(Looper.java:148)                                                                at android.app.ActivityThread.main(ActivityThread.java:5417)                                                                at java.lang.reflect.Method.invoke(Native Method)                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

The issue is more stranger, because once it will produce ANR and crash, then it works in next launches.

My dependencies:

compile 'com.google.firebase:firebase-core:9.4.0' //not working  compile 'com.google.firebase:firebase-crash:9.4.0' compile 'com.google.firebase:firebase-invites:9.4.0' compile 'com.google.firebase:firebase-ads:9.4.0'  compile 'com.google.android.gms:play-services-auth:9.4.0' compile 'com.google.android.gms:play-services-plus:9.4.0' compile 'com.google.android.gms:play-services-drive:9.4.0'

回答1:

The issue has been introduced with the Google Play Services 9.6.80 (currently in rollout) and affects all the apps using the Firebase Crash reporting (despite of the version bundled in your app).

  • Temporary solution: disable Firebase Crash by removing the following entry from the build.gradle:

    compile 'com.google.firebase:firebase-crash:9.x.x'

  • Long term solution: wait that Google releases a fixed version of the GPS before enabling Firebase Crash again.


UPDATE 09/16:

Google is rolling out a fixed version of Google Play Services (9.6.83) which addresses the issue with Firebase Crash.



回答2:

Disable the Firebase Analytics Crash Reporting, use the below code inside app.gradle file.Hope this will help you

configurations {

  all*.exclude group: 'com.google.firebase', module: 'firebase-crash'

}



回答3:

9.6.83 still gives a different anr crash Our app when pushed to Play Store Beta and when installed on devices crashes the first time on launch. Subsequently it works , but we cannot push to prod without understanding the issue.

Here is the ANR crash report

java.lang.RuntimeException: Unable to instantiate receiver com.google.android.gms.analytics.CampaignTrackingReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.analytics.CampaignTrackingReceiver"

Edit : We had to add compile 'com.google.android.gms:play-services-analytics:9.4.0' explicitly and the launch anr for first time got resolved. But I am not sure that was the fix as we dont use the library at all. Maybe Playstore fixed their bug to all apks?



回答4:

Just for the record:

We solved the DynamiteModulesC NPE and Uncaught exception in Firebase runloop (3.0.0) by removing following line

//remove this "feature" if you should use it FirebaseApp.setAutomaticResourceManagmentEnabled(true)

API description:

If set to true it indicates that Firebase should close database connections automatically when the app is in the background. Disabled by default.

(Might be, that we missed some configurations for correct usage of this feature, but App is working as expected after not enabling the ResourceManagment)



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