FirebaseInstallation class crashing in Android - android

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.

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.

This issue is already fixed by firebase in their latest release. I was using previous releases and now I have updated to the latest one. For more information visit this link.
https://github.com/firebase/firebase-android-sdk/issues/2147

Related

IllegalArgumentException when update firebase library

My Android app work fine before I update firebase libs. After updating to the newest firebase lib I got following Exception:
E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.sound.booster.extra.volume, PID: 24298
java.lang.IllegalArgumentException: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google.
at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(Unknown Source:8)
at com.google.firebase.iid.FirebaseInstanceId.zza(com.google.firebase:firebase-iid##20.1.7:52)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(com.google.firebase:firebase-iid##20.1.7:2)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(com.google.firebase:firebase-iid##20.1.7:1)
Src before update libs:
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-config:19.1.0'
implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
Src after update libs:
implementation 'com.google.firebase:firebase-messaging:20.1.7'
implementation 'com.google.firebase:firebase-config:19.1.4'
implementation 'com.google.firebase:firebase-core:17.4.1'
implementation 'com.google.firebase:firebase-analytics:17.4.1'
Could anyone explain why and how to fix this issue?
Newer versions of the Firebase SDKs depends on a service called Firebase Installations Service, which adds some extra requirements on the configuration data about the Firebase project that you include in your application. In your case it seems that you're missing a project ID in this configuration.
If you configure the Firebase project for your app by including a google-services.json in your app, the solution is typically to get the latest version of that file from the Firebase console and update in your app.
If you configure the Firebase project for your app explicitly in code, you will need to make sure that you call the setProjectId method in there.
Also see:
FirebaseInstallationsException on latest version
Firebase cannot communicate with Firebase Server
the release notes of the SDK version where this new dependency was introduced

How to ensure all firebase SDKs are the compatible version?

Currently we have a lot of firebase version.
firebase_core_version = '16.0.6'
firebase_perf_version = '16.2.2'
firebase_messaging_version = '17.3.4'
...
implementation "com.google.firebase:firebase-core:$firebase_core_version"
implementation "com.google.firebase:firebase-perf:$firebase_perf_version"
implementation "com.google.firebase:firebase-messaging:$firebase_messaging_version"
...
But they each have different version number and sometimes they are conflicting or resolved to unexpected versions by transitive includes. Or other module declares different version for same library... That steals my time.
Is there any solutions for this?
Gradle has "BoM" feature that is available from 5.0. and it enables you free from version hell.
implementation platform('com.google.firebase:firebase-bom:20.0.1')
implementation 'com.google.firebase:firebase-perf'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-appindexing'
implementation 'com.google.firebase:firebase-config'
You may notice that only new import firebase-bom has version and any other libraries don't have version.
This is because BoM dependency contains all firebase version inside it (of course they are compatible!).
So your module always import firebase-bom then version conflict will be gone.
firebase-bom is currently experimental but it works for me.
https://firebase.google.com/docs/android/setup#firebase-bom
I hope androidx (jetpack) also have this!
There is also okhttp-bom available.
https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp-bom

Android gradle sync : Could not get resource firebase-measurement-connector-impl-17.0.4-javadoc.jar

I'm using Android Studio last version 3.2.1
I've created a sample project for testing the problem I have on my main app. I thought at first it was a thing of my app, but I get the same problem on the very simple test app.
So here app the important dependencies of the test app :
classpath 'com.android.tools.build:gradle:3.2.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
Gradle sync works fine.
But as soon as I add these 2 lines in dependencies
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
Gradle sync generate 2 warnings about 2 missing javadocs :
org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-measurement-connector-impl/17.0.4/firebase-measurement-connector-impl-17.0.4-javadoc.jar
org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-core/16.0.6/firebase-core-16.0.6-javadoc.jar'
It's a warning, OK, but on my main app which have almost 100 flavors, gradle generate 200 failing http requests which delays the gradle sync significantly.
Is there a way I coud ask gradle to stop requesting these files ?
After a couple of tests, it seems that the problem is with
implementation 'com.google.firebase:firebase-core:16.0.6'
I replaced it with
implementation 'com.google.firebase:firebase-core:16.0.5'
And I don't get the warnings anymore. It seems that somebody forgot to provide all the javadocs for last version 16.0.6 of firebase-core. I can live with not using the last version, so I'll use 16.0.5 to avoid this warning.

What is the latest firebase-ui-auth for firebase auth 12.0.0

Not able to find anywhere the version used for firebase-auth 12.0.0.
Github page shows the version upto 11.8.0.
Used 3.2.2 but showing error in android studio..
Not able to use com.google.android.gms:play-services-location:12.0.0 because of firebase auth 11.8.0
Mixed versions error was coming.
They have not updated the UI-Auth API. They usually run a few versions behind the Firebase Auth API. The latest UI version is 3.2.2 which corresponds to 11.8.0. You'll have to wait for sometime to for the UI Auth API to get updated.
Following the instructions in the documentation for upgrading dependencies, add these to your dependencies, replacing 27.x.x with the version of the Support Libs you are using:
implementation "com.google.firebase:firebase-auth:12.0.0"
implementation "com.google.android.gms:play-services-auth:12.0.0"
implementation "com.android.support:design:27.x.x"
implementation "com.android.support:customtabs:27.x.x"
implementation "com.android.support:cardview-v7:27.x.x"

Fix the version conflict either by updating the version of the google-services plugin or updating the version of com.google.android.gms to 11.8.0 [duplicate]

This question already has an answer here:
How to add firebase-admin to my android project?
(1 answer)
Closed 5 years ago.
I'm developing an Android app using Firebase, and went to install the Admin SDK using this tutorial. In my build.gradle file in my app, I've had a couple of dependencies that have given me warnings since I added them earlier in the project, but I was still able to run the application. Once I added the dependency needed for Admin SDK, things got a little more serious...
These are the original dependencies and their warnings:
implementation 'com.google.firebase:firebase-core:11.8.0'
All gms/firebase libraries must be the exact same version specification. Found versions 9.6.0, 11.8.0
implementation 'com.android.support:appcompat-v7:26.1.0'
All com.android.support libraries must be the exact same version specification. Found versions 26.1.0, 23.4.0
I searched the whole project using the double-shift search function in Android Studio and couldn't find anything that used either of the conflicting versions mentioned (9.6.0 or 23.4.0).
Like I said, the app still ran so I carried on developing. While adding the Firebase Admin SDK, I added the following dependency to my build.gradle:
implementation 'com.google.firebase:firebase-admin:5.6.0'
When I hit 'sync' on my gradle, I got the following error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.8.0.
This has left me a bit confused as I believe the most recent version of com.google.firebase:firebase-admin to be 5.6.0, so I don't see how I can be getting a version conflict for using this.
My app won't run while this error exists, so any help getting past it would be very much appreciated. I'm new to Android development so it might well be something very obvious that I've missed.
Here is my full list of dependencies:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0' <-- warning
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.8.0' <-- warning
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.firebaseui:firebase-ui:0.6.0'
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-admin:5.6.0' <-- introduced error
implementation 'com.google.firebase:firebase-messaging:11.8.0'
}
If I can include anything else that will help with diagnosing, please let me know!
Thanks in advance,
Mark
The Firebase admin SDK is meant for JVM servers and can't be used in tandem with client SDKs. See this great post for more details. I would recommend using Cloud Functions for admin stuff instead since they're something you control and can't be compromised on the client.

Categories

Resources