hiển nguyễn văn
hiển nguyễn văn

Reputation: 23

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?

Upvotes: 0

Views: 2966

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599551

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:

Upvotes: 3

Related Questions