German Fehlermeldung bei Android 14

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
Hallo,

meine App funktioniert unter Android-Version 14 und älter einwandfrei. Allerdings tritt ab Version 14 ein Problem auf, bei dem die App abstürzt.

Ich bitte um Unterstützung bei der Lösung dieses Problems.

Fehlermeldung:

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) **


Manifest schaut so aus:

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:compileSdkVersion="33" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)

SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
android:debuggable="false"/>)

'Damit die Tastaur unter dem Textfeld bleibt.
SetActivityAttribute(generalsettings, android:windowSoftInputMode, adjustPan|stateHidden)
'End of default text.

'AddPermission(android.permission.INTERNET)

SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values, colors.xml,
<resources>
<color name="actionbar">#FF5E7A0B</color>
<color name="statusbar">#FF5E7A0B</color>
<color name="textColorPrimary">#ff9BC300</color> <!-- Softkey Button color -->
<color name="navigationBar">#FF5E7A0B</color>
</resources>
)
CreateResource(values-v20, theme.xml,
<resources>
<style name="LightTheme" parent="@android:style/Theme.Material.Light">
<item name="android:colorPrimary">@color/actionbar</item>
<item name="android:colorPrimaryDark">@color/statusbar</item>
<item name="android:textColorPrimary">@color/textColorPrimary</item>
<item name="android:navigationBarColor">@color/navigationBar</item>
<item name="android:colorAccent">#FF5E7A0B</item> <!-- checkboxes,, switches,, etc. -->
</style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
<style name="LightTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
</style>
<style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/actionbar</item>
</style>
</resources>
)
 

DonManfred

Expert
Licensed User
Longtime User
Uploade ein kleines Projekt was das Problem zeigt.

Mit den gelieferten Infos kann dir wohl kaum jemand helfen.
 

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
Hi,

die Fehlermeldung bekomme ich dann, wenn ich den Winsock aufrufe.

Winsock aufrufen:
StartService(Winsock)

Und im Winsock Modul, befinden sich eine Methode:

Methode:
Sub SubCalling
    Log("LOGIN_OK")
    
    ToastMessageShow("Connected with " & Variablen.Modul_Name,False)
    CallSub(GeneralSettings,"Schriftarten_Laden")
    CallSub(GeneralSettings,"CLOSE_Left_Menue")
    StartActivity(Input_Output)
    UpdateState (True)
    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))
    UpdateNotification
    Service.StartForeground(1,Notification1)
    begin_Time = True
    zahler = 0
    
    CallSub(GeneralSettings, "Device_Network_Daten_vom_Modul_abrufen")
    CallSub(Input_Output, "FirstConnectToDevice")
        
    CallSub(GeneralSettings,"Elemente_Aktivieren_Deaktivieren_bei_WINSOCK_CLOSE_oder_WINSOCK_isOPEN")
End Sub

Und genau an dieser Stelle ist der Fehler:

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

Sobald ich das aus kommentiere, ist der Fehler nicht mehr da.
 
Top