OkHttpClient damaged after upgrade Retrofit Retrofit 2

I got this error after upgrading from retrofit to retrofit2.

FATAL EXCEPTION: OkHttp dispatcher Process: nz.co.datacom.mars.junction, PID: 21616
java.lang.NoSuchMethodError: there is no virtual log method (Ljava / lang / String;) V in the class Lokhttp3 / internal / Platform; or its superclasses (the declaration "okhttp3.internal.Platform" appears in /data/app/nz.co.datacom.mars.junction-1/base.apk)
in okhttp3.logging.HttpLoggingInterceptor $ Logger $ 1.log (HttpLoggingInterceptor.java : 109) in okhttp3.logging.HttpLoggingInterceptor.intercept (HttpLoggingInterceptor.java:157) in okhttp3.RealCall $ ApplicationInterceptorChain.proceed (RealCall.java:190) at okhttp3.RealCall.getResponseChithReal3eralper.allalercepter .access $ 100 (RealCall.java:30)
at okhttp3.RealCall $ AsyncCall.execute (RealCall.java:127)
at okhttp3.internal.NamedRunnable.run (NamedRunnable.java:32)
in java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:ava util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java=888) in java.lang.Thread.run (Thread.java:818)

The libs version that I used in the application:

    compile 'com.squareup.okhttp3:okhttp:3.2.0'
    compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
    compile 'com.squareup:otto:1.3.7'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'

Not sure if this is due to the okhttp version or not, but I tried several different versions between 2.3.0 and 3.4.0 and none of them work.

Any ideas? Thanks in advance.

+4
source share
1 answer

Had the same problem as you.

First of all, throw away:

compile 'com.squareup.okhttp3:okhttp:3.2.0'

okhttp3 , . , Retrofit 2.1.0 okhttp 3.3.0, . , - , gradle. , gradle .

Logging Interceptor urlconnection:

compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'

, .

+10

Source: https://habr.com/ru/post/1649237/


All Articles