问题
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
}
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)
This happens even if I use Maybe, Single or Observable. How can this issue be resolved?
回答1:
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.
To do it, go to Build, Execution, Development
-> Instant Run
in Settings.
来源:https://stackoverflow.com/questions/44111928/failed-resolution-of-lcom-google-devtools-build-android-desugar-runtime-throwab