Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal - Interface not implemented - OkHttp3 - Android

I am requesting a JSON file with OkHttp3, RetroFit 2.0 + RxObservable and it throws Interface not implemented. This appears to only happen on Android 4.3 users who are running an older version of our app and upgrade to the latest app version.

01-19 16:43:31.089 1611-1692/? E/AndroidRuntime: FATAL EXCEPTION: IntentService[MyDataIntentService]
                                     java.lang.IncompatibleClassChangeError: interface not implemented
                                         at okhttp3.internal.Util.closeQuietly(Util.java:100)
                                         at okhttp3.internal.connection.StreamAllocation.streamFailed(StreamAllocation.java:332)
                                         at okhttp3.internal.http.RetryAndFollowUpInterceptor.recover(RetryAndFollowUpInterceptor.java:209)
                                         at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:132)
                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                         at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:212)
                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                         at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                         at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
                                         at okhttp3.RealCall.execute(RealCall.java:63)
                                         at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
                                         at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:144)
                                         at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:125)
                                         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)
                                         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
                                         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)
                                         at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
                                         at rx.Observable.subscribe(Observable.java:8759)
                                         at rx.Observable.subscribe(Observable.java:8726)
                                         at rx.Observable.subscribe(Observable.java:8581)
                                         at com.somepackage.someclass.loadSomeJSONThing(MyFile.kt:61)

Here's the call:

//get returns Observable<Any>
myApi.getSomeObj("some_id")
     .subscribe({ responseHandler(it) },
                { Crashlytics.logException(it) })
like image 686
Tim Nuwin Avatar asked Apr 02 '26 03:04

Tim Nuwin


1 Answers

I think this is an OkHttp regression. We’re incorrectly assuming Socket implements Closeable, which isn't the case for older devices. Will fix very soon.

Fixed here: https://github.com/square/okhttp/pull/3125

like image 90
Jesse Wilson Avatar answered Apr 08 '26 06:04

Jesse Wilson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!