【问题标题】:Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;解析失败:Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
【发布时间】:2017-05-22 11:38:58
【问题描述】:

我在 AndroidStudio 的最新预览版中使用 RxJava 和 Retrofit。我的项目启用了 java 1.8 支持,如下所示:

compileOptions {
    targetCompatibility 1.8
    sourceCompatibility 1.8
}

但是当代码被编译和运行时,我得到这个错误,只要发出请求,即使我有 onError 处理程序:

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 也会发生这种情况。如何解决这个问题?

【问题讨论】:

    标签: android rx-java retrofit2 android-studio-3.0


    【解决方案1】:

    这实际上不是 RxJava 错误,也不是 Retrofit。这是即时运行错误,我禁用了它并启动了我的应用程序。

    作为临时解决方案,您也可以禁用Instant run

    为此,请转到“设置”中的Build, Execution, Development -> Instant Run

    【讨论】:

    猜你喜欢
    • 2017-05-10
    • 2015-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-13
    • 2018-09-24
    • 2018-11-08
    • 2019-06-25
    相关资源
    最近更新 更多