Android Question JavaObject not works in Android 14

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
Hi,

Hello,

My app works perfectly on Android version 9 and older. However, starting from version 14, an issue occurs that causes the app to crash.

I would appreciate support in solving this problem.

B4X:
Dim socket As JavaObject = r.GetField("socket")
Dim jo As JavaObject = Me
 jo.RunMethod("setKeepaliveSocketOptions", Array(socket, 1000, 1000, 3))


I didn’t have any problems with this on Android 9.
 

aeric

Expert
Licensed User
Longtime User
I suggest you share the error message that you get.
Can it be changes in protocol?
 
Upvote 0

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
"Is there a way to modify this code so that it also runs on Android 14?"

B4X:
Dim r As Reflector
    r.Target = Socket1
    Dim socket As JavaObject = r.GetField("socket")
    Dim jo As JavaObject = Me
    jo.RunMethod("setKeepaliveSocketOptions", Array(socket, 1000, 1000, 3))
 
Upvote 0

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
Error MSG

winsock_subcalling (java line: 1543)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at yamutec.app.winsock._subcalling(winsock.java:1543)
at yamutec.app.winsock._astreams_newdata(winsock.java:397)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.NoSuchMethodException: libcore.io.ForwardingOs.setsockoptInt [class java.io.FileDescriptor, int, int, int]
at java.lang.Class.getMethod(Class.java:2937)
at java.lang.Class.getDeclaredMethod(Class.java:2914)
at yamutec.app.winsock.setKeepaliveSocketOptions(winsock.java:2009)
... 15 more
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:258)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at yamutec.app.winsock._subcalling(winsock.java:1543)
at yamutec.app.winsock._astreams_newdata(winsock.java:397)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
... 9 more
Caused by: java.lang.NoSuchMethodException: libcore.io.ForwardingOs.setsockoptInt [class java.io.FileDescriptor, int, int, int]
at java.lang.Class.getMethod(Class.java:2937)
at java.lang.Class.getDeclaredMethod(Class.java:2914)
at yamutec.app.winsock.setKeepaliveSocketOptions(winsock.java:2009)
... 15 more
** Activity (input_output) Create (first time) **
** Activity (input_output) Resume **
Connected with Modulname wird in das LABEL geschrieben
Connected with Modulname wird in das LABEL geschrieben
** Activity (input_output) Pause, UserClosed = false **
** Activity (main) Create (first time) **
The time now is: 11/07/2024 - 16:36:57
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (generalsettings) Create (first time) **
 
Upvote 0

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
This

B4X:
Dim r As Reflector
    r.Target = Socket1
    Dim socket As JavaObject = r.GetField("socket")
    Dim jo As JavaObject = Me
    jo.RunMethod("setKeepaliveSocketOptions", Array(socket, 1000, 1000, 3))


And this one:
B4X:
Service.StartForeground(1,Notification1)

and this one
B4X:
StartService(Winsock)
 
Upvote 0
Top