Android Question OkHttpUtils2: onReceive not found in httputils2service

Wosl

Member
I've the same issue as posted by #peacemaker. Error occurs when I run the app in release mode (in debug mode all is fine):
B4X:
HTTP Service started
main_starthttputils2service (java line: 7458)
java.lang.RuntimeException: Method: onReceive not found in: b4a.example.httputils2service
    at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
    at b4a.example.main._starthttputils2service(main.java:7458)
    at b4a.example.main$ResumableSub_Activity_Create.resume(main.java:612)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:215)
    at anywheresoftware.b4a.keywords.Common$12.run(Common.java:1212)
    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:8934)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

My configuration is as following:

Android Version: v14
B4A Version: v12.20 (64 bit)
OkHttpUtils2: 3.01 (Internal lib)

As mentioned in the referenced post an update to B4A v13 and to OkHttpUtils2 v3.04 could solve the issue. Any other suggestions?

Can I update to OkHttpUtils2 v3.04 (or newer version) without moving to B4A v13? If yes, how?

If an update to B4A v13 from v12 is required, how can I do this without reinstall the complete B4X suite (upgrade guide from BVA V12 to v13)? I would like to avoid a complete re-installation of B4X.

I need some guidance ... any help is appreciated.

Wosl
 

Wosl

Member
Thank you Erel,

I'll start an update, sure, need to read the instructions carefully.

Just as a remark:
The mentioned exception happens in case following additional sub is implemented (as recommended in https://www.b4x.com/android/forum/threads/httputils2service-starts-at-a-random-time-depending-on-devices.149846/ ) and the code is running in release mode:

B4X:
Private Sub StartHttpUtils2Service
    #if release
    If HttpUtils2Service.TempFolder = "" Then
        Dim jo As JavaObject
        jo.InitializeNewInstance(Application.PackageName & ".httputils2service", Null)
        jo.RunMethod("onReceive", Array(Null, Null))
    End If
    #end if
End Sub

For sure, this code segment is only active in release mode. I'm not a Java expert: any suggestions how to cure the code?

Wosl
 
Upvote 0
Top