cordova-plugin-firebase: FirebaseApp is not initalized.

After building a new release to submit to the store I am now getting the following error appear when I call ‘getToken’

Default FirebaseApp is not initialized in this process processName Make sure to call FirebaseApp.initializeApp(Contect) first.

This is only happening on android the same build is working on IOS, also this error was not present on the last build I did last year.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I had this issue. I built the generated android project in the platform in android studio then I found the issue and solved this.

Follow this steps.

Inside the platforms folder, android/src/{package name}/MainActivity.java

Import the firebase library,

  • import com.google.firebase.FirebaseApp;

Inside the oncreate method, below super.oncreate(savedinstancestate),

Add FirebaseApp.initializeApp(this);

Last step,

Inside the platforms folder, android/res/values/string.xml,

Add <string name="google_app_id" templateMergeStrategy="preserve" translatable="false">***</string>

*** can be found in the googleservice.json file “client”: [ { “client_info”: { “mobilesdk_app_id”: this value

Thank you so much @AyoGitNg. It worked well. I love you. 👍 Hahahaha

3 weeks ago with this error.

I actually got this error to go away. I started a fresh project to check if it was something with the plugin and was not getting an error.

I checked the difference between this and my project and realized I had the google-services.json and GoogleService-Info.plist in the root of the project once I removed these it all worked fine.

Edit: Also I am using phonegap so I have these files commited into the plugin directly.