Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

firebase.login error #68

Closed
Nikoms opened this issue Jul 7, 2016 · 7 comments
Closed

firebase.login error #68

Nikoms opened this issue Jul 7, 2016 · 7 comments

Comments

@Nikoms
Copy link

Nikoms commented Jul 7, 2016

Hello there,

I'm using firebase with the last version of nativescript (2.1.1), and I get an error when I try to login:

JS: Error in firebase.login: Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
JS: com.google.android.gms.common.zze.isGooglePlayServicesAvailable(Unknown Source)
JS: com.google.android.gms.common.zzc.isGooglePlayServicesAvailable(Unknown Source)
JS: com.google.android.gms.common.GoogleApiAvailability.isGooglePlayServicesAvailable(Unknown Source)
JS: com.tns.Runtime.runModule(Native Method)
JS: com.tns.Runtime.runModule(Runtime.java:241)
JS: com.tns.Runtime.run(Runtime.java:235)
JS: com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
JS: android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
JS: android.app.ActivityThread.handleBindApplication(ActivityThread.java:6321)
JS: android.app.ActivityThread.access$1800(ActivityThread.java:222)
JS: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1861)
JS: android.os.Handler.dispatchMessage(Handler.java:102)
JS: android.os.Looper.loop(Looper.java:158)
JS: android.app.ActivityThread.main(ActivityThread.java:7229)
JS: java.lang.reflect.Method.invoke(Native Method)
JS: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
JS: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

I just do this on my "init" promise:

firebase.login({ type: firebase.LoginType.ANONYMOUS }).then( function (result) { console.log('ok'); }, function (errorMessage) { console.log('ko'); } );

I don't know if it's related to firebase or this plugin or android?

@EddyVerbruggen
Copy link
Owner

I'm guessing you're doing login before application.start(). Is that right?

@Nikoms
Copy link
Author

Nikoms commented Jul 7, 2016

Indeed, sorry for the inconvenience :)

@Nikoms Nikoms closed this as completed Jul 7, 2016
@EddyVerbruggen
Copy link
Owner

No worries. I'll try and harden the plugin so it can cope with that setup better.

EddyVerbruggen added a commit that referenced this issue Jul 8, 2016
@EddyVerbruggen
Copy link
Owner

Just pushed a change to this repo (not on npm yet) where you should be able to call login before application.start()

@Nikoms
Copy link
Author

Nikoms commented Jul 8, 2016

Amazing Eddy! Thank you

EddyVerbruggen added a commit that referenced this issue Apr 18, 2017
@NicholasSmilovic
Copy link

Just in case someone else encounters the same error message when using nativescript-plugin-firebase.
If you change the android:name="com.tns.NativeScriptApplication" inside the AndroidManifest.xml when enabling multidex for pre lollipop devices this error happens.

https://docs.nativescript.org/runtimes/android/advanced-topics/extend-application-activity
Instead of using the android:name=org.myApp.Application from the example in the link above. Use com.tns.NativeScriptApplication inside of application.android.ts.

@genautkin
Copy link

angular nativescript
In build.Gradle
deleted multiDexEnabled true
and it fixes it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants