Hello,
I'm facing an issue with the HttpJob class from the OkHttpUtils2 library after updating B4A to the latest version (likely 13.40 or higher) and using android.jar from SDK 36 (C:\Android\platforms\android-36\android.jar). The code works perfectly on emulators with API 34 (Android 14) or higher but fails on a physical device running Android 11 (API 30).
Details:
Questions:
Any help or suggestions would be greatly appreciated!
I'm facing an issue with the HttpJob class from the OkHttpUtils2 library after updating B4A to the latest version (likely 13.40 or higher) and using android.jar from SDK 36 (C:\Android\platforms\android-36\android.jar). The code works perfectly on emulators with API 34 (Android 14) or higher but fails on a physical device running Android 11 (API 30).
Details:
- B4A Setup: Latest B4A version, configured with android.jar from SDK 36, targetSdkVersion=35 (also tested with targetSdkVersion=30), and minSdkVersion=14.
- Device: Android 11 (API 30), physical device.
- Code: A simple HttpJob GET request to https://httpbin.org/get with a 60-second timeout.
- Issue: The code stops at the log "4. Timeout configured" before the JobDone event is triggered. No errors appear in the logs, and the Wait For (ping) JobDone never completes.
- Previous Behavior: The code worked fine before updating B4A to use SDK 35/36.
- Logs: Added detailed logs (see below), but execution halts after ping.GetRequest.Timeout = 60000 without reaching JobDone or showing errors.
- Manifest: Includes INTERNET and ACCESS_NETWORK_STATE permissions, <queries> for HTTPS, and usesCleartextTraffic="true" for testing.
- Tests Tried:
- Tested with a different endpoint (https://www.google.com) – same result.
- Disabled battery optimizations and tested on different networks – no change.
- Confirmed latest OkHttpUtils2 library is used.
Questions:
- Could the android.jar from SDK 36 cause compatibility issues with Android 11 when using OkHttpUtils2?
- Are there specific manifest settings or OkHttpUtils2 configurations needed for Android 11 when compiled with SDK 36?
- Any known issues with HttpJob on Android 11 with the latest B4A and SDK 36?
Any help or suggestions would be greatly appreciated!
Test HttpJob:
Sub pinga
Dim ping As HttpJob
Log("1. Initializing HttpJob")
ping.Initialize("ping", Me)
Log("2. HttpJob initialized")
ping.Download("https://httpbin.org/get")
Log("3. Download started")
ping.GetRequest.Timeout = 60000
Log("4. Timeout configured")
Try
Wait For (ping) JobDone(ping As HttpJob)
Log("5. JobDone called: Success=" & ping.Success)
If ping.Response <> Null Then
Log("6. Response StatusCode: " & ping.Response.StatusCode)
Try
Log("7. Response String: " & ping.GetString)
Catch
Log("8. Error getting string: " & LastException.Message)
End Try
Else
Log("6. Response is Null")
End If
Log("9. PING success? " & ping.Success & " code=" & IIf(ping.Response <> Null, ping.Response.StatusCode, -1))
If ping.Success = False Then
Log("10. PING error: " & ping.ErrorMessage)
End If
Catch
Log("11. Error in Wait For: " & LastException.Message)
End Try
ping.Release
Log("12. HttpJob released")
End Sub