Android Question FireaseAuth-NullPointerException on Initialize(B4A: 10.2)

Paolodc

Member
I heve been trying to use FirebaseAuth library
When compile I have this error:

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 25 (Main)
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.auth.FirebaseAuth.addAuthStateListener(com.google.firebase.auth.FirebaseAuth$AuthStateListener)' on a null object reference
at anywheresoftware.b4a.objects.FirebaseAuthWrapper.Initialize(FirebaseAuthWrapper.java:73)
at com.time.FirebaseAuth.main._activity_create(main.java:394)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.time.FirebaseAuth.main.afterFirstLayout(main.java:105)
at com.time.FirebaseAuth.main.access$000(main.java:17)
at com.time.FirebaseAuth.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5307)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
** Activity (main) Resume **

Versions:
B4A: 10.2
FirebaseAuth library: 2.0
com.google.firebase:firebase-auth (Google Maven) version 16.0.1



I saw the scsic'tread (https://www.b4x.com/android/forum/t...ith-last-versions-b4a-8-30.93595/#post-592133), but I tried what Erel said but it still doesn't work. However, two years have passed and maybe something has changed.

Thanks for who will answer me.
 

Paolodc

Member
Resolved
I didn't add all the necessary snippet:
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)
 
Upvote 0
Top