Cordova-plugin-firebase: FirebaseApp is not initalized.

Created on 12 Jan 2017  ·  17Comments  ·  Source: arnesson/cordova-plugin-firebase

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.

Most helpful comment

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

All 17 comments

Same problem here.

This already happened to me too (not sure why). I could resolve the error by forcing a reinstallation (remove then add the plugin through the cordova cli).

Not worked. removed, add again and same 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.

The same with my app. It is in Ionic 2, working just fine on IOS, but on Android I get an error:

"Native: tried calling Firebase.onTokenRefresh, but the Firebase plugin is not installed."

And plugin sure is installed. This is the line of code I have in my config.xml:

I'm using:

Cordova CLI 6.5.0

Platforms:

IOS 4.3.1

Android 6.1.2

Hi,

I am facing same issue in android plugin:

Default FirebaseApp is not initialized in this process com.x.xyz. Make sure to call FirebaseApp.initializeApp(Context) first.

Please suggest.

Duplicate: https://github.com/arnesson/cordova-plugin-firebase/issues/206

Thanks

Yes, I am having the same issue. Any help?

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 for your solution! It worked great!

Thank you! Very helped!

Thank you for your solution!!!!

A post-prepare cordova hook to implement ayngitng's solution.

https://gist.github.com/bdirito/74ba45ef314d2d9f9afb73f37ecf815a

Thank you so much @AyoGitNg. It worked well. I love you. :+1: Hahahaha

3 weeks ago with this error.

@rubikcuber or @mgpartssource a pull request?
Is not possible to release a version with this fix? @arnesson

STILL HAPPENING, version 1.0.5

+1

AyoGitNg Thanks this worked for me

Was this page helpful?
0 / 5 - 0 ratings