Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FirebaseInitProvider: FirebaseApp initialization unsuccessful

We have followed the Add Firebase to your Android Project but we can't see the app receiving data in the Firebase Console.
And when we launch the app, the log says:

FirebaseInitProvider: FirebaseApp initialization unsuccessful 

What does this mean? What are we doing wrong?
I can't find this error in the docs, nor here in StackOverflow.

like image 503
Salvatorelab Avatar asked May 19 '16 11:05

Salvatorelab


2 Answers

What does this mean? What are we doing wrong?

Would assume, that the authentication did not succeed.

a) the buildscript repositories and dependencies for the project level build.gradle:

buildscript {     repositories {         google()         jcenter()     }     dependencies {                  // Android Gradle Plugin         classpath "com.android.tools.build:gradle:3.3.2"          // Google Services Plugin         classpath "com.google.gms:google-services:4.2.0"     } } 

b) the dependencies for the module level app/build.gradle (the Android Intel x86 images may still have a previous version of the Google Play Services installed, eg. 10.2.0 runs on the current x86 emulator, while eg. 11.8.0 runs on my physical ARM device). referencing play-services and firebase-core will include all of their modules, unless excluding some them. update: one has to reference all the libraries individually now. referencing com.google.android.gms:play‐services and com.google.firebase:firebase-core does not work anymore since 15.0.0.

android {     ...     buildTypes {         debug {             // suffixing the package name for debug builds,             // in order to partially mute the crash-reporting             // is an *optional* configuration (see below):             applicationIdSuffix ".debug"         }     } }  dependencies {      // Google Play Services     // https://developers.google.com/android/guides/releases     implementation "com.google.android.gms:play-services-base:15.0.1"     implementation "com.google.android.gms:play-services-auth:16.0.0"     implementation "com.google.android.gms:play-services-identity:15.0.1"      // Google Firebase     // https://firebase.google.com/support/release-notes/android     implementation "com.google.firebase:firebase-core:16.0.1"     implementation "com.google.firebase:firebase-auth:16.0.3"     implementation "com.google.firebase:firebase-config:16.0.0"     implementation "com.google.firebase:firebase-storage:16.0.1"     implementation "com.google.firebase:firebase-database:16.0.1"     implementation "com.google.firebase:firebase-messaging:17.3.0"     implementation "com.google.firebase:firebase-appindexing:16.0.1"     implementation "com.google.firebase:firebase-functions:16.1.0"     implementation "com.google.firebase:firebase-invites:16.0.1"     // implementation "com.google.firebase:firebase-crash:16.0.1"     implementation "com.google.firebase:firebase-ads:15.0.1"     implementation "com.google.firebase:firebase-firestore:17.0.4"     implementation "com.google.firebase:firebase-perf:16.0.0"      // the inapp messaging may cause dependency conflicts:      // implementation "com.google.firebase:firebase-inappmessaging:17.0.0"     // implementation "com.google.firebase:firebase-inappmessaging-display:17.0.0" } 

c) the bottom line of mobile/build.gradle should be:

// apply the Google Services Plugin apply plugin: "com.google.gms.google-services" 

d) make sure to have the (downloaded) credentials available at app/google-services.json; on the Firebase Console, one has to add both SHA1 (or SHA256) hashes, of the debug and the release keys, in order to have both builds authenticating properly; once it all matches, it should report:

I/FirebaseInitProvider: FirebaseApp initialization successful 

It's all well documented, just see Setup Google Play Services, Firebase Quickstart or Crash Reporting; while I find this article on the Firebase Blog quite useful: Organizing your Firebase-enabled Android app builds, because it explains how to partially mute the crash-reporting. The release notes always announce the updates & changes.

like image 157
Martin Zeitler Avatar answered Sep 20 '22 12:09

Martin Zeitler


It happens when you dont have apply plugin: 'com.google.gms.google-services' in your app/build.gradle. Try adding it.

Also make sure you have Google Play services SDK installed in Android SDK Manager.

like image 43
Sayyam Avatar answered Sep 24 '22 12:09

Sayyam