I am using libraries below with my Java MVC project.
<dependency org="com.squareup.retrofit2" name="retrofit" rev="2.4.0"
conf="common->default"/>
<dependency org="com.squareup.okhttp3" name="okhttp" rev="3.10.0"/>
<dependency org="com.squareup.okio" name="okio" rev="1.14.0"/>
<dependency org="com.squareup.retrofit2" name="converter-gson" rev="2.4.0"/>
I am getting the error below when I make a call. Here is the error:
Exception in thread "OkHttp Dispatcher" java.lang.NoSuchMethodError: okio.BufferedSource.readUtf8LineStrict(J)Ljava/lang/String;
at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:215)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I am not sure what is happening here. I tried different version of the library but no progress. Thanks in advance.
I solved this issue, it was a problem with version. Here is the version, I am using and worked.
<dependency org="com.squareup.retrofit2" name="retrofit" rev="2.3.0" conf="common->default"/>
<dependency org="com.squareup.okhttp3" name="okhttp" rev="3.8.0"/>
<dependency org="com.squareup.okio" name="okio" rev="1.13.0"/>
<dependency org="com.squareup.retrofit2" name="converter-gson" rev="2.3.0"/>
<dependency org="com.squareup.okhttp3" name="logging-interceptor" rev="3.8.0"/>
<dependency org="com.google.code.gson" name="gson" rev="2.7"/>