FirebaseInstallation class crashing in Android

Viewed 449

Firebase Crashlytics have been reporting this crash on huge number of devices having Android 8 and Android 6 on playstore. We are using dexguard in the app too.

Environment and Components I am using are as below.

Project build.gradle

classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0' // Crashlytics plugin
classpath 'com.google.firebase:perf-plugin:1.3.1'  // Performance Monitoring plugin

App build.gradle

implementation 'com.google.firebase:firebase-messaging:20.2.1'
implementation 'com.google.firebase:firebase-analytics:17.4.3'
implementation 'com.google.firebase:firebase-crashlytics:17.1.0'
implementation 'com.google.firebase:firebase-perf:19.0.7'

These are the logs I am getting from Crashlytics.

???
com.google.firebase.installations.FirebaseInstallations.INotificationSideChannel$Stub$Proxy

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at com.google.firebase.installations.FirebaseInstallations.INotificationSideChannel$Stub$Proxy(:452)
at com.google.firebase.installations.FirebaseInstallations.INotificationSideChannel$Stub$Proxy(:331)
at com.google.firebase.installations.FirebaseInstallations.INotificationSideChannel$Stub$Proxy(:296)
at com.google.firebase.installations.FirebaseInstallations$$Lambda$3.run(:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)

It is not giving any hint so we can reproduce that crash on our devices but It is causing to a huge number of users.

2 Answers

My first guess it that you're using some incompatible versions of the Firebase SDKs, as there are many interdependencies under the hood.

These days, I'd recommend using the Firebase BoM (bill of materials) to manage all the SDK versions. This allows you to specify a version only once (the version of the BoM), and then include all other SDKs without specifying a version.

To use the latest BoM and the SDKs in your question it'd look like:

implementation platform('com.google.firebase:firebase-bom:26.0.0')

implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-perf'

If you want to see (or compare) what SDK versions are included in a certain BoM version, check this handy BoM version comparator.

Related