Android Question Crash in OkHttpUtils2 3.00

Creideiki

Active Member
Licensed User
Longtime User
Hi,

I'm using OkHttpUtils2 to search for updates in background via a service.
Now I got this error message:
Stack Trace:
Fehlermeldung: java.lang.Exception: java.lang.NoClassDefFoundError: okhttp3/internal/platform/Platform
Stack-Trace:
java.lang.NoClassDefFoundError: okhttp3/internal/platform/Platform
    at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:237)
    at okhttp3.OkHttpClient$Builder.build(OkHttpClient.kt:1069)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.Initialize(OkHttpClientWrapper.java:94)
    at de.okabrechnungssysteme.HKZaehlerB4A.httputils2service._service_create(httputils2service.java:294)
    at de.okabrechnungssysteme.HKZaehlerB4A.httputils2service._submitjob(httputils2service.java:318)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1181)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5584)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
    at dalvik.system.NativeStart.main(Native Method)

Has anybody an idea what could have gone wrong here? The crash seems to happen in the constructor of OkHttpClient, which is called from the httputils2service create... well, a NoClassDefFoundError is quite confusing, either.
I couldn't reproduce the crash yet, and it's quite difficult to find the cause if I don't know where to search...

Perhaps another important information: The App is compiled with B4A 11.50 and the crach happend with Android 4.4.2.

Thanks.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
'm using OkHttpUtils2 to search for updates in background via a service.
You are using which B4A Version?

You are running the code on which Android Version???? <--- !!!

New new okhttputils2 need Android 5+
 
Upvote 0

Creideiki

Active Member
Licensed User
Longtime User
Sorry, you were too fast for me:
The App is compiled with B4A 11.50 and the crash happend with Android 4.4.2.

New new okhttputils2 need Android 5+
Well, that would explan that. Thank you!
 
Upvote 0

Creideiki

Active Member
Licensed User
Longtime User
I have to dig further though...

It seems we have quite a lot of Android 4.4.2 devices out there.

I didn't find changelogs or the like for okhttputils2... so since when did it support only 5+?

What would be the best method to manage this problem?
- use an older okhttputils - is it possible to replace the one which is delivered with the ide? Where can I get it?
- use an older version of the ide? (which?)
- use another http lib - is there any, since okhttputils do what it should?
 
Upvote 0

Creideiki

Active Member
Licensed User
Longtime User
yes, there's a okhttp-3.12.12 dated 14.12.2021 in the Libraries folder; that should be from B4A 11.20. It was released on 17.05.2020 btw... perhaps it's time to cut old pigtails. I have to see.
Thank you anyway for the information!
 
Upvote 0
Top