HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient httpClient = new OkHttpClient.Builder().addInterceptor(logging).build();
.client(httpClient)
An error:
FATAL EXCEPTION: OkHttp Dispatcher
Process: com.ld.smb, PID: 4129
java.lang.NoSuchMethodError: okhttp3.internal.Platform.log
at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:109)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:157)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
at okhttp3.RealCall.access$100(RealCall.java:30)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Why?Why?
You're using different versions of the okhttp and logging-interceptor artifacts. All OkHttp dependencies should be using the same version. 3.5.0 is the latest.
Thank you!!!
Most helpful comment
You're using different versions of the
okhttpandlogging-interceptorartifacts. All OkHttp dependencies should be using the same version. 3.5.0 is the latest.