Crashlytics error: E/FirebaseCrashlytics: Error fetching settings. A valid Firebase Project ID is required to communicate with Firebase server APIs

Issue

I am facing this problem it says:

Error fetching settings. java.lang.IllegalArgumentException: Please
set your Project ID. A valid Firebase Project ID is required to
communicate with Firebase server APIs: It identifies your application
with Firebase. Please refer to
https://firebase.google.com/support/privacy/init-options.

2021-08-09 16:58:43.621 14510-14510/com.stackoverflow I/FirebaseCrashlytics: Initializing Firebase Crashlytics 18.2.0 for com.stackoverflow 2021-08-09 16:58:43.698 14510-14619/com.stackoverflow V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils 2021-08-09 16:58:43.937 14510-14625/com.stackoverflow V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils 2021-08-09 16:58:46.269 14510-14624/com.stackoverflow E/FirebaseCrashlytics: Error fetching settings.
    java.lang.IllegalArgumentException: Please set your Project ID. A valid Firebase Project ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.
        at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(com.google.android.gms:play-services-basement@@17.6.0:4)
        at com.google.firebase.installations.FirebaseInstallations.preConditionChecks(FirebaseInstallations.java:179)
        at com.google.firebase.installations.FirebaseInstallations.getId(FirebaseInstallations.java:240)
        at com.google.firebase.crashlytics.internal.common.IdManager.fetchTrueFid(IdManager.java:167)
        at com.google.firebase.crashlytics.internal.common.IdManager.getCrashlyticsInstallId(IdManager.java:117)
        at com.google.firebase.crashlytics.internal.settings.network.DefaultSettingsSpiCall.applyHeadersTo(DefaultSettingsSpiCall.java:184)
        at com.google.firebase.crashlytics.internal.settings.network.DefaultSettingsSpiCall.invoke(DefaultSettingsSpiCall.java:108)
        at com.google.firebase.crashlytics.internal.settings.SettingsController$1.then(SettingsController.java:199)
        at com.google.firebase.crashlytics.internal.settings.SettingsController$1.then(SettingsController.java:192)
        at com.google.android.gms.tasks.zzp.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:64)
        at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27)
        at java.lang.Thread.run(Thread.java:923)

I have downloaded my google-services.json and overwritten the previous one. However, nothing solved. Of cause I have these google-services settings in both project and app level build.gradles. The app has already been enabled at Firebase Console. Why isn’t my google-services.json‘s project_id properly read?

implementation platform('com.google.firebase:firebase-bom:28.3.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'

Solution

I have figured out the cause of this problem.

DO NOT UPDATE TO 'com.google.gms:google-services:4.3.9' though Android Studio suggests to that!

classpath 'com.google.gms:google-services:4.3.9'

I’ve just reverted it to 4.3.8, the problem is cleared.

Currently, the Google’s official document only mentions about 4.3.8. Don’t trust Android Studio recklessly.

Answered By – hata

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published