问题描述
我在AndroidStudio的最新预览版上将RxJava与Retrofit一起使用.我的项目启用了Java 1.8 suport,如下所示:
I'm using RxJava with Retrofit on the newest preview of AndroidStudio. My project has java 1.8 suport enabled like this:
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
但是,当代码被编译并运行时,即使有 onError
处理程序,在发出请求后,我也会收到此错误:
But when the code is compiled and run I'm getting this error, as soon as the request is made, even if I have the onError
handler:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:281)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:58)
at io.reactivex.Observable.subscribe(Observable.java:10179)
at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
at io.reactivex.Observable.subscribe(Observable.java:10179)
at io.reactivex.internal.operators.flowable.FlowableFromObservable.subscribeActual(FlowableFromObservable.java:31)
at io.reactivex.Flowable.subscribe(Flowable.java:12218)
at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest.subscribeActual(FlowableOnBackpressureLatest.java:31)
at io.reactivex.Flowable.subscribe(Flowable.java:12218)
即使我使用Maybe,Single或Observable,也会发生这种情况.该问题如何解决?
This happens even if I use Maybe, Single or Observable. How can this issue be resolved?
推荐答案
这实际上不是RxJava错误,也不是翻新.这是即时运行错误,我禁用了它,并启动了我的应用程序.
This is in fact not RxJava error neither Retrofit. It is Instant run error, i disabled it and my app launched.
作为临时解决方案,您也可以禁用即时运行
.
As a temporary solution, you can disable Instant run
, too.
要执行此操作,请在设置"中转到 Build,Execution,Development
-> Instant Run
.
To do it, go to Build, Execution, Development
-> Instant Run
in Settings.
这篇关于无法解决以下问题:Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!