Android Question [SOLVED] Errors with Firebase

GeoT

Active Member
Licensed User
Longtime User
Hi.

I do not know if due to the update of the Firebase Cloud Messaging API or the B4A updates, I get an error when connecting to it. Specifically there is a problem with the SubscribeTopic(topicName As String) method of FirebaseNotifications library.
.

B4X:
firebasemessaging_subscribetotopics (java line: 184)
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.firebase.iid.FirebaseInstanceId.zza(java.lang.String)' on a null object reference
    at com.google.firebase.messaging.FirebaseMessaging.subscribeToTopic(Unknown Source)
    at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
    at xerp.xerpchat.firebasemessaging._subscribetotopics(firebasemessaging.java:184)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1135)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
--------- beginning of crash

I use B4A v7.80 and I have already updated the FirebaseNotifications library to version 1.21.

My intention is to use messaging and notifications.



And also FirebaseAuth fails me.
It shows me
B4X:
"Object reference not set as an instance of an object".

Thank you.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

GeoT

Active Member
Licensed User
Longtime User
Thanks Erel.

I do not know if it was to recreate the project in Firebase and it took a while to update, or because I substituted the Manifest Editor code that I had for the code of https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/#content, which now works for me. In my B4A v7.80.


But not another project with the example of FirebaseAuth, that with your modifications, now also shows me an error with the message:

B4X:
An error has occurred.
Unable to find a part of the path 'C:\Android\extras\b4a_remote\com\google\firebase\firebase-auth\15.1.0\firebase-auth-15.1.0'.

I use the FirebaseAuth v1.02 library.
 
Upvote 0

GeoT

Active Member
Licensed User
Longtime User
Hello Erel.

I followed all the steps but with FirebaseAuth I still show the error:

B4X:
"Object reference not set as an instance of an object".

:(
 
Upvote 0

GeoT

Active Member
Licensed User
Longtime User
There are no logs. A window opens before with that error message.

2j1psfm.jpg
 
Last edited:
Upvote 0

GeoT

Active Member
Licensed User
Longtime User
It is a test project that only works here with FirebaseAuth, but with another code and the same package name, it works with Google Maps.
 
Upvote 0

GeoT

Active Member
Licensed User
Longtime User
Ok Erel. So I have to install a newer version of B4A and keep working with the Google FirebaseAuth file v15.1.0?

Should Gradle be used? How?
 
Upvote 0

GeoT

Active Member
Licensed User
Longtime User
Thanks DonManfred and Erel.

The new version of B4A warned me that the package name was misspelled and I corrected it in the Compilation Settings. ^^

And I see that we must continue working for the moment with the file FirebaseAuth v15.1.0.

But when I click on the btnSignIn button, it shows me the error:

B4X:
main_btnsignin_click (java line: 379)
java.lang.NullPointerException
    at anywheresoftware.b4a.objects.FirebaseAuthWrapper$2.ResultArrived(FirebaseAuthWrapper.java:130)
    at anywheresoftware.b4a.BA.startActivityForResult(BA.java:540)
    at anywheresoftware.b4a.objects.FirebaseAuthWrapper.SignInWithGoogle(FirebaseAuthWrapper.java:141)
    at com.proves.tomkygo.main._btnsignin_click(main.java:379)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:4439)
    at android.widget.Button.performClick(Button.java:148)
    at android.view.View$PerformClick.run(View.java:18395)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:5319)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)
 
Upvote 0

GeoT

Active Member
Licensed User
Longtime User
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
FirebaseAuth initialized
** Activity (main) Resume **
onAuthStateChanged: com.google.firebase.auth.internal.zzj@424e7198
SignInWithGoogle called
SignInWithGoogle.ResultArrived
main_btnsignin_click (java line: 379)
java.lang.NullPointerException
    at anywheresoftware.b4a.objects.FirebaseAuthWrapper$2.ResultArrived(FirebaseAuthWrapper.java:130)
    at anywheresoftware.b4a.BA.startActivityForResult(BA.java:540)
    at anywheresoftware.b4a.objects.FirebaseAuthWrapper.SignInWithGoogle(FirebaseAuthWrapper.java:141)
    at com.proves.tomkygo.main._btnsignin_click(main.java:379)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:4439)
    at android.widget.Button.performClick(Button.java:148)
    at android.view.View$PerformClick.run(View.java:18395)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:5319)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)
--------- beginning of /dev/log/system


No, FirebaseAuth has never worked for me. It's the first time I've tried it.
 
Upvote 0
Top