Android Question (SOLVED) OkHTTPUtils2 NoSuchMethod Error

Ferdari

Active Member
Licensed User
Longtime User
Hi everyone,

i have a library that depends on OkHttp 3.11.0.jar and okio-1.14.0.jar, but also im using OkHttpUtils2 for downloading some files, if i manually add the #AdditionalJar it throws error: already added files, then if i use only the internal library OkHttpUtils2 and OkHttp this error happens:
B4X:
FATAL EXCEPTION: pool-12-thread-1
Process: com.app, PID: 24984
java.lang.NoSuchMethodError: No static method get(Ljava/lang/String;)Lokhttp3/HttpUrl; in class Lokhttp3/HttpUrl; or its super classes (declaration of 'okhttp3.HttpUrl' appears in base.apk)
    at com.huawei.agconnect.https.AnnotationHandler$UrlHandler.parse(AnnotationHandler.java:101)
    at com.huawei.agconnect.https.AnnotationHandler.checkUrlAnnotation(AnnotationHandler.java:83)
    at com.huawei.agconnect.https.AnnotationHandler.parseAnnotation(AnnotationHandler.java:40)
    at com.huawei.agconnect.https.RequestFactory.create(RequestFactory.java:21)
    at com.huawei.agconnect.https.Method$Post.create(Method.java:36)
    at com.huawei.agconnect.https.HttpsService$1.call(HttpsService.java:40)
    at com.huawei.agconnect.https.HttpsService$1.call(HttpsService.java:34)
    at com.huawei.hmf.tasks.a.j$1.run(Unknown Source:4)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)

It appears that the B4A internal library has an old version of OkHttp or Okio, what can i do?

Can be the internal lib has no GET method?

Is is possible to exclude the internal OkHttp and Okio and use my own lib, but without breaking my downloads sub.

Your help are very appreciated.
 
Last edited:

Ferdari

Active Member
Licensed User
Longtime User
Solved deleting the DepensOn in OkHttp.xml
XML:
    <dependsOn>okhttp-3.5.0</dependsOn>
    <dependsOn>okio-1.11.0</dependsOn>
And adding my own okio and okhttp jar with #AdditionalJar
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…