相关文章推荐
微笑的香烟  ·  I'm facing ECONNRESET ...·  10 月前    · 

E/AndroidRuntime。FATAL EXCEPTION: OkHttp Dispatcher 版本不一致 4.9.0 和 4.11.0 如何解决?

1 人关注

这里是我的okhttp gradle版本。

implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0'

还有我的okHttp记录器库。

implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'

我在github上发现了这个问题,这里的回复说这是由于版本不一致造成的。 https://github.com/square/okhttp/issues/2839#issuecomment-244923226

但是Okhttp logger还没有更新他们的库OkHttp的版本是 4.9.0 ,而okHttp是 4.11.0 。我可以把版本降低到 4.9.0 ,但我不想这样做。就像Jake Wharton在这里的建议一样。 https://github.com/square/okhttp/issues/2839#issuecomment-245269471

E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
    Process: tech.guzo.awtar, PID: 7624
    java.lang.NoSuchMethodError: No virtual method log(ILjava/lang/String;Ljava/lang/Throwable;)V in class Lokhttp3/internal/platform/Platform; or its super classes (declaration of 'okhttp3.internal.platform.Platform' appears in /data/app/tech.guzo.awtar-XZo1TJ-jaQnVlyXeTlwUdQ==/base.apk!classes3.dex)
        at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:111)
        at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:159)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
        at com.yenepay.yegid.net.ServerAPI$1.intercept(ServerAPI.java:106)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:502)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

谁能给我指导一下你是如何克服这个问题的?