Android Question Firebase Example Crashing

Randy Younger

Member
Licensed User
I have meticulously followed the tutorials and examples for Firebase Push Notifications. My project compiles and installs, but crashes here:

Public Sub SubscribeToTopics
fm.SubscribeToTopic("general") 'you can subscribe to more topics
End Sub

With the following error logs:

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
Error occurred on line: 15 (FirebaseMessaging)
java.lang.RuntimeException: Object should first be initialized (FirebaseMessaging).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
at com.pushtest.firebasemessaging._subscribetotopics(firebasemessaging.java:263)
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$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
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)
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**

I have verified that the object "fm" is initialized. If I comment out the line the app runs, but obviously I am not receiving notifications. Can anyone offer help here?
 

drgottjr

Expert
Licensed User
Longtime User
you sure it's initialized before it's actually used?
 
Upvote 0

Randy Younger

Member
Licensed User
Yes it was. I got it to work by reinstalling the SDK and Java. Even though I was using the latest of both. It is a little frustrating that some of the examples from earlier times are not up to date with the current and latest of the SDK and other tools. Anyway, I am good for now. Thank you!
 
Upvote 0
Top