IllegalArgumentException when update firebase library - android

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

Related

Android firebase failed build.gradle implementation

I'm in the final stages putting my project on cloud firebase. Added all required firebase requirements using the firebase console. The Android compile fails with the error: Could not find com.google.firebase:firebase-appcheck-playintegrity:.
This is a copy of the implementation in the build.gradle file:
implementation 'com.google.firebase:firebase-appcheck-playintegrity'
Is this the correct statement for these dependencies? I assume there is no version number. This project is my first attempt putting a project on the cloud firebase. Appreciate any help.
Roger
As per the documentation:
https://firebase.google.com/docs/app-check/android/play-integrity-provider?authuser=0#install-sdk
You don’t need to specify version only if you also defined BoM dependency. Otherwise version is required.
dependencies {
// Declare the dependency for the App Check library
// When NOT using the BoM, you must specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-appcheck-playintegrity:16.0.0'
}

FirebaseInstallation class crashing in 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

Firebase Warning to use firebase-core library when using firebase-messaging library

I am using firebase:firebase-messaging library for push notification. While building the application I am seeing a warning which says
Warning: The app Gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended.
Release notes by firebase say
https://developers.google.com/android/guides/releases#may_23_2018
Firebase now requires the app Gradle file to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.
Firebase-core library is used for analytics, what will happen if I don't include this library? I am already using gms:play-services-analytics.
Also, I have found the library version for both gms:play-services-analytics must be the same as firebase:firebase-core library to avoid any build error.
Something like below
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
Will there be any impact on the application if I will include firebase:firebase-core library in application gradle along with gms:play-services-analytics?
Why firebase is showing the above warning ?
What will be impacted if I don't include firebase-core with firebase-messaging library? A warning can be ignored?
Is this due to firebase adding analytics for all its features?
Here: https://support.google.com/firebase/answer/6383877?hl=en
If you don't include com.google.firebase:firebase-core, then you won't be able to use the other firebase services like firebase-database or firebase-messaging.
If you are using google-service version 3.2.1+, then you can use different library versions for gms:play-services-analytics and firebase:firebase-core.

Do I need Firebase Core for Firebase Database?

I use only Firebase Database and I've added only the next dependency:
implementation 'com.google.firebase:firebase-database:16.0.1'
it seems works ok
but during compilation I get next warning
Warning: The app gradle file must have a dependency on
com.google.firebase:firebase-core for Firebase services to work as
intended.
Should I still add Core? like:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
Yes, you have to explicitly list it now:
Update - June 12, 2018
Your app gradle file now has to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.
more info here:
https://firebase.google.com/support/release-notes/android

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"

Categories

Resources