Android Question firebase messaging error

Makumbi

Active Member
Licensed User
please help i get this error when i try to run my project please help

B4X:
java.lang.RuntimeException: Unable to create service com.kccug.kabojjajuniorapp.starter: java.lang.RuntimeException: java.net.SocketException: Socket closed
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3544)
    at android.app.ActivityThread.access$1300(ActivityThread.java:199)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    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:858)
Caused by: java.lang.RuntimeException: java.net.SocketException: Socket closed
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:164)
    at anywheresoftware.b4a.shell.Shell.start(Shell.java:102)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:92)
    at com.kccug.kabojjajuniorapp.starter.onCreate(starter.java:34)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3532)
    ... 8 more
Caused by: java.net.SocketException: Socket closed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
    at java.net.SocketInputStream.read(SocketInputStream.java:176)
    at java.net.SocketInputStream.read(SocketInputStream.java:144)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:288)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:347)
    at java.io.DataInputStream.readFully(DataInputStream.java:198)
    at java.io.DataInputStream.readInt(DataInputStream.java:389)
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:136)
    ... 12 more
 

Brandsum

Well-Known Member
Licensed User
Socket closed error happens if the IDE unexpectedly lost connection with the app in debug mode.
 

Makumbi

Active Member
Licensed User
DO you really expect to get help with this (nearly ZERO) information you provide?
B4X:
Public Sub SubscribeToTopics
    'fm.SubscribeToTopic("general") 'you can subscribe to more topics
    'fm.SubscribeToTopic("No0781703474") 'you can subscribe to more topics
    
    cursor1 = Starter.SQL1.ExecQuery("SELECT phone AS Phone,Sex FROM Register")
    If cursor1.RowCount > 0 Then
        '    For i = 0 To cursor1.RowCount - 1
        cursor1.Position =0
        Dim Phoneg As String
        Phoneg = cursor1.Getstring("Phone")
        Log(Phoneg)
        fm.SubscribeToTopic(Phoneg) 'you can subscribe to more topics
        
        'Next
    End If
End Sub
the error comes at this code below
B4X:
fm.SubscribeToTopic(Phoneg) 'you can
that is when i try to SubscribeToTopic to my phone number the error is flagged
 

Makumbi

Active Member
Licensed User
B4X:
Public Sub SubscribeToTopics
    'fm.SubscribeToTopic("general") 'you can subscribe to more topics
    'fm.SubscribeToTopic("No0781703474") 'you can subscribe to more topics
  
    cursor1 = Starter.SQL1.ExecQuery("SELECT phone AS Phone,Sex FROM Register")
    If cursor1.RowCount > 0 Then
        '    For i = 0 To cursor1.RowCount - 1
        cursor1.Position =0
        Dim Phoneg As String
        Phoneg = cursor1.Getstring("Phone")
        Log(Phoneg)
        fm.SubscribeToTopic(Phoneg) 'you can subscribe to more topics
      
        'Next
    End If
End Sub
the error comes at this code below
B4X:
fm.SubscribeToTopic(Phoneg) 'you can
that is when i try to SubscribeToTopic to my phone number the error is flagged
sorry for not submitting the entire log file but it is like this

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Class not found: b4a.example.b4xtable, trying: com.kccug.kabojjajuniorapp.b4xtable
0
Class not found: b4a.example.b4xfloattextfield, trying: com.kccug.kabojjajuniorapp.b4xfloattextfield
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
0782911364
java.lang.NoSuchMethodError: No virtual method subscribeToTopic(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/messaging/FirebaseMessaging; or its super classes (declaration of 'com.google.firebase.messaging.FirebaseMessaging' appears in base.apk)
    at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
    at com.kccug.kabojjajuniorapp.firebasemessaging._subscribetotopics(firebasemessaging.java:305)
    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:6669)
    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:858)
java.lang.RuntimeException: java.lang.NoSuchMethodError: No virtual method subscribeToTopic(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/messaging/FirebaseMessaging; or its super classes (declaration of 'com.google.firebase.messaging.FirebaseMessaging' appears in base.apk)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:175)
    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:6669)
    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:858)
Caused by: java.lang.NoSuchMethodError: No virtual method subscribeToTopic(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/messaging/FirebaseMessaging; or its super classes (declaration of 'com.google.firebase.messaging.FirebaseMessaging' appears in base.apk)
    at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
    at com.kccug.kabojjajuniorapp.firebasemessaging._subscribetotopics(firebasemessaging.java:305)
    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)
    ... 8 more
where 0782911364 is the phone number subscribed to
 

DonManfred

Expert
Licensed User
Please post the path in B4A Sdk Manager and the path of android.jar under Tools - Configure Paths.
 

DonManfred

Expert
Licensed User
The paths are text. USE TEXT to post them.
Additionally you posted just one path and i asked for two paths.

Note that your additional library folder should NEVER be inside the programs folder as it is a restricted folder!
 

Makumbi

Active Member
Licensed User
c
The paths are text. USE TEXT to post them.
Additionally you posted just one path and i asked for two paths.

Note that your additional library folder should NEVER be inside the programs folder as it is a restricted folder!
can i just copy the entire libraries for B4a android to drive c where i can create a folder then paste everything there
 

DonManfred

Expert
Licensed User
Start with answering all questions! If you just ignore them then don´t expect me to try further helping here.

Additionally you should start a new thread for any new question.
 
Last edited:

DonManfred

Expert
Licensed User
You can use AnyDesk and give me your Anydesc ID. I´ll connect to your pc and help you seting up the SDK correctly. I fear you did not setup it correctly.
 
Top