Nativescript-plugin-firebase: FirebaseApp with name [DEFAULT] doesn't exist

Created on 28 May 2016  路  9Comments  路  Source: EddyVerbruggen/nativescript-plugin-firebase

Hi Guys,

I have been trying to make this plugin to work in my project, but I am stuck with this error:

V/JS      (32145): firebase.init error: Error: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist. 
V/JS      (32145):     com.google.firebase.FirebaseApp.getInstance(Unknown Source)
V/JS      (32145):     com.google.firebase.FirebaseApp.getInstance(Unknown Source)
V/JS      (32145):     com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
V/JS      (32145):     com.tns.Runtime.callJSMethodNative(Native Method)
V/JS      (32145):     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
V/JS      (32145):     com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
V/JS      (32145):     com.tns.Runtime.callJSMethod(Runtime.java:712)
V/JS      (32145):     com.tns.Runtime.callJSMethod(Runtime.java:693)
V/JS      (32145):     com.tns.Runtime.callJSMethod(Runtime.java:683)
V/JS      (32145):     com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:13)
V/JS      (32145):     android.app.Activity.performCreate(Activity.java:6021)
V/JS      (32145):     android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
V/JS      (32145):     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
V/JS      (32145):     android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
V/JS      (32145):     android.app.ActivityThread.access$800(ActivityThread.java:155)
V/JS      (32145):     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)
V/JS      (32145):     android.os.Handler.dispatchMessage(Handler.java:102)
V/JS      (32145):     android.os.Looper.loop(Looper.java:135)
V/JS      (32145):     android.app.ActivityThread.main(ActivityThread.java:5376)
V/JS      (32145):     java.lang.reflect.Method.invoke(Native Method)
V/JS      (32145):     java.lang.reflect.Method.invoke(Method.java:372)
V/JS      (32145):     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
V/JS      (32145):     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

Most helpful comment

Same here, did everything exactly as documented in README, more than one time.

Started a project from scratch and tried again, problem stills present.

For days I'm looking for a solution.

All 9 comments

I may have forgotten to add something to the readme. Can you please try this to see if that fixes your problem?

  • Open platforms/android/build.gradle
  • Near the top there's a dependencies section, add classpath "com.google.gms:google-services:3.0.0" so it becomes something like:
    dependencies {
        classpath "com.android.tools.build:gradle:1.5.0"
        classpath "com.google.gms:google-services:3.0.0"
    }
  • Add the very bottom of the same file add apply plugin: "com.google.gms.google-services"

Thanks Eddy,

It works now. One question: Is there a way to made this changes permanent? I mean to survive when we remove and then add android platform....

Thanks for the quick check!

I don't think it will persist indeed.

I'll keep this open as a reminder to figure out how to do this via the plugin (if at all possible), but for now I'll add it to the readme.

Hi Eddy,

It worked initially, but after google sdk update, I got this error:

Found com.google.android.gms:play-services-gcm:8.4.0, but version 9.0.0 is needed for the google-services plugin.

I have googled all the day, it is supposed that I have to add

compile 'com.google.android.gms:play-services:9.0.0'

to the dependencies in the app level build.gradle, but in nativescritp there is no "app level" build.gradle.
I have tried in app/App_Resources/android/app.gradle with no success.

EDIT:
I deleted node_modules and platforms directories and now everything is work.... oh no. Now I have reached the 65k dex limit :(

Added a bunch of these (and other) issues to the readme (scroll down).

I did all of the above, the problem is still present...

I followed your tutorial video.

Same here, did everything exactly as documented in README, more than one time.

Started a project from scratch and tried again, problem stills present.

For days I'm looking for a solution.

@gabrielpiassetta I just continued the app development. The error doesn't affect the app in any way( from wha i have seen ). So just carry on. It will be fixed eventually.

Same here (done everything from readme, error still bugs me but doesn't affect the app...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thunder413 picture thunder413  路  3Comments

NickIliev picture NickIliev  路  3Comments

jlooper picture jlooper  路  3Comments

EddyVerbruggen picture EddyVerbruggen  路  3Comments

SBD580 picture SBD580  路  3Comments