java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Platform

09-20 11:16:43.121 11934-11934/? E/Zygote: MountEmulatedStorage()

? ? v2

09-20 11:16:43.121 11934-11934/? E/Zygote: accessInfo : 0

09-20 11:16:43.121 11934-11934/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL

09-20 11:16:46.621 11934-12167/com.hotbitmapgg.ohmybilibili E/AndroidRuntime: FATAL EXCEPTION: RxIoScheduler-2

? ? Process: com.hotbitmapgg.ohmybilibili, PID: 11934

? ? java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.

? ? ? ? at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:62)

? ? ? ? at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)

? ? ? ? at java.util.concurrent.FutureTask.run(FutureTask.java:237)

? ? ? ? at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)

? ? ? ? at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)

? ? ? ? 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:818)

? ? Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Platform;

? ? ? ? at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:109)

? ? ? ? at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:157)

? ? ? ? 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.execute(RealCall.java:77)

? ? ? ? at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)

? ? ? ? at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:171)

? ? ? ? at rx.internal.operators.OperatorSubscribeOn$1$1$1.request(OperatorSubscribeOn.java:80)

? ? ? ? at rx.Subscriber.setProducer(Subscriber.java:211)

? ? ? ? at rx.internal.operators.OperatorSubscribeOn$1$1.setProducer(OperatorSubscribeOn.java:76)

? ? ? ? at rx.internal.operators.OperatorMap$MapSubscriber.setProducer(OperatorMap.java:99)

? ? ? ? at rx.Subscriber.setProducer(Subscriber.java:205)

? ? ? ? at rx.Subscriber.setProducer(Subscriber.java:205)

? ? ? ? at rx.Subscriber.setProducer(Subscriber.java:205)

? ? ? ? at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)

? ? ? ? at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)

? ? ? ? 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.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)

? ? ? ? at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)

? ? ? ? at rx.Observable.unsafeSubscribe(Observable.java:8460)

? ? ? ? at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)

? ? ? ? at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:222)

? ? ? ? at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)

? ? ? ? at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)?

? ? ? ? at java.util.concurrent.FutureTask.run(FutureTask.java:237)?

? ? ? ? at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)?

? ? ? ? at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)?

? ? ? ? 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:818)?

? ? Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Platform" on path: DexPathList[[zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/base.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.hotbitmapgg.ohmybilibili-2/split_lib_slice_9_apk.apk"],nativeLibraryDi

09-20 11:16:46.641 11934-11934/com.hotbitmapgg.ohmybilibili E/RecyclerView: No adapter attached; skipping layout

? ? No adapter attached; skipping layout

09-20 11:16:46.701 11934-11934/com.hotbitmapgg.ohmybilibili E/RecyclerView: No adapter attached; skipping layout



解決問(wèn)題:

使用OKHttp3作為網(wǎng)絡(luò)訪問(wèn)的框架時(shí),可能要經(jīng)常查看日志,這時(shí)我們可以引入logging-interceptor攔截器。如下:

compile'com.squareup.okhttp3:logging-interceptor:3.8.1'

1

但是,如果出現(xiàn)如題目中的錯(cuò)誤,那原因應(yīng)該就是logging-interceptor的版本和OkHttp3的版本不一樣,保持一樣就可以了。

compile'com.squareup.okhttp3:logging-interceptor:3.8.1'compile'com.squareup.okhttp3:okhttp:3.8.1'

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容