Android Question Firebase Authentication Sample - Error on auth.Initialize("auth") statement

virpalacios

Member
Licensed User
Hi All, I am trying to run Erel's Firebase Authentication Sample Program, I already update command line tools and resources as Erel indicates, I am on B4A 10.0 and using SDK 26, also I registered app in firebase console and got the json file (put with b4a. program). Howerer al Program start I got this message

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.

Thanks in Advance for Any Advise to fix this issue.

Best Regards
Log messages:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 352)
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 mc.auth.app.main._activity_create(main.java:352)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at mc.auth.app.main.afterFirstLayout(main.java:105)
    at mc.auth.app.main.access$000(main.java:17)
    at mc.auth.app.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:836)
    at android.os.Handler.dispatchMessage(Handler.java:103)
    at android.os.Looper.loop(Looper.java:203)
    at android.app.ActivityThread.main(ActivityThread.java:6251)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
 
Last edited:

virpalacios

Member
Licensed User
Hi Erel, Thanks for your promptly answer, I downloaded B4X 10.2, however I still getting the same message, please let me know if there is additional checking to be made in order to run the Sample Program.

Best Regards
 
Upvote 0

DonManfred

Expert
Licensed User
Looks like you are using an OLD SDK?

Did you setup a new SDK for 10.2?
 
Upvote 0

virpalacios

Member
Licensed User
Hi Erel and DonManfred I got the Sample Working, here are the issues I have to fix in order to get it working
  • Update B4A to latest version
  • Update SDK to latest version
Add MacroSnipet in Manifest with related Firebase Services in My Case (Firebase Authorization)
  • CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
  • CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
  • CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)

After that compile and everthing is working

Thanks both for your help and support

Best Regards and Greetings from Panama

Virgilio
 
Upvote 0
Top