致命 - 界面未实现 - OkHttp3 - Android

时间:2017-01-19 22:54:19

标签: android okhttp rx-android

我正在使用OkHttp3,RetroFit 2.0 + RxObservable请求一个JSON文件,它会抛出未实现的接口。这似乎只发生在运行旧版应用并升级到最新应用版本的Android 4.3用户身上。

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)

这是电话:

//get returns Observable<Any>
myApi.getSomeObj("some_id")
     .subscribe({ responseHandler(it) },
                { Crashlytics.logException(it) })

1 个答案:

答案 0 :(得分:2)

我认为这是一个OkHttp回归。我们错误地认为Socket实现Closeable,而旧设备不是这种情况。很快就会解决。

修正了这里:https://github.com/square/okhttp/pull/3125