Android Question Firebase Authentication

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello all,

I'm trying to implement Firebase Authentication using this thread : https://www.b4x.com/android/forum/t...seauth-to-support-facebook.67954/#post-430482

But when the test app is starting I'm getting the error:
B4X:
*** Service (starter) Create ***
Error occurred on line: 13 (Starter)
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 b4a.comten.firebase.starter._service_create(starter.java:175)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at b4a.comten.firebase.starter.onCreate(starter.java:56)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3749)
    at android.app.ActivityThread.access$1400(ActivityThread.java:213)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1826)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6923)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
** Service (starter) Start **

"line 38" is the same of sample code (no changes), in starter service:

B4X:
Sub Service_Create
    
    auth.Initialize("auth")  <--- Line 38
    facebook.Initialize

End Sub


It's all configured in Firebase and Google/Facebook. Does anybody know what could be happening?

Thanks !
 

f0raster0

Well-Known Member
Licensed User
Longtime User
have you checked this:
or this
or this
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
have you checked this:
or this
or this
Thanks @f0raster0 ... I found what happened . Basically, the sample app was without the Firebase manifest lines . After to add these lines the app ran without any problem.
I hope that this tip could help other developers to avoid to do the same mistake.

Thanks šŸ˜Š !!! šŸ™
 
Upvote 0
Top