RxJavaPlugins 错误找不到类“com.google.devtools.build.

时间:2023-02-12
本文介绍了RxJavaPlugins 错误找不到类“com.google.devtools.build.android.desugar.runtime.ThrowableExtension"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级 Android Studio 3.0 Beta 1 后出现以下错误.当我降级时,错误消失了.

After upgrading Android Studio 3.0 Beta 1 getting the following error. When I downgraded the error disappeared.

Studio 构建:Android Studio 3.0 Beta 1Gradle 插件版本:'com.android.tools.build:gradle:3.0.0-beta1'Gradle 版本:.0.0-beta1Java 版本:8操作系统:MacOSX

Studio Build: Android Studio 3.0 Beta 1 Version of Gradle Plugin: 'com.android.tools.build:gradle:3.0.0-beta1' Version of Gradle:.0.0-beta1 Version of Java: 8 OS: MacOSX

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:364)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:113)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.ClassNotFoundException: 
Didn't find class "com.google.devtools.build.android.desugar.runtime.ThrowableExtension" on path: DexPathList[[zip file "/data/app/sark.savvy.Debug-1/base.apk",
 zip file "/data/app/sark.savvy.Debug-1/split_lib_dependencies_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_0_apk.apk",
  zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_1_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_2_apk.apk",
   zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_3_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_4_apk.apk", 
   zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_5_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_6_apk.apk",
    zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_7_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_8_apk.apk",
     zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/sark.savvy.Debug-1/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:364) 
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:113) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 

推荐答案

更新(仍在使用 Gradle 插件 3.0.0-beta5,由@TmTron 确认)

Update (still working in Gradle plugin 3.0.0-beta5, confirmed by @ TmTron)

classpath 'com.android.tools.build:gradle:3.0.0-beta5'

<小时>

更新(在 Gradle 插件 3.0.0-beta4 中修复)


Update (fix in Gradle plugin 3.0.0-beta4)

在 Gradle 插件 3.0.0-beta4 中再次修复了该问题.预计将包含在下一个 AS 3.0 Beta 4 中,但通过更新顶级 build.gradle 已经可以在当前的 AS 3.0 Beta 3 中使用:

Issue fixed again in Gradle plugin 3.0.0-beta4. Expected to be included in next AS 3.0 Beta 4, but can be already used in current AS 3.0 Beta 3 by updating top level build.gradle:

classpath 'com.android.tools.build:gradle:3.0.0-beta4'

<小时>

更新(AS 3.0 Beta 3 中的回归)


Update (regression in AS 3.0 Beta 3)

这个问题又回到了 beta 3.Google 已经意识到这个问题并重新打开了它.请参阅 https://issuetracker.google.com/issues/64527520

The issue is back on beta 3. Google is already aware of the issue and has reopened it. See https://issuetracker.google.com/issues/64527520

在未来的 beta 4 中修复,等待发布.

Fixed in future beta 4, pending to be released.

感谢@yvolk 的报告和@ghui-zhang 的确认.

Thanks @yvolk for reporting it and @ghui-zhang for the confirmation.

最终更新(在 AS 3.0 Beta 2 中修复)

Final Update (fix in AS 3.0 Beta 2)

正如 Jordan Bondo 在评论中所说,AS 3.0 Beta 2 已经发布,其中包含修复该问题的插件 3.0.0-beta2.

As Jordan Bondo says in his comment, AS 3.0 Beta 2 is already released containing the plugin 3.0.0-beta2 that fixes the issue.

因此,解决方案是将插件从 3.0.0-beta1 升级到至少 3.0.0-beta2.

So, the solution is to upgrade the plugin from 3.0.0-beta1 to at least 3.0.0-beta2.

历史

Google 在此问题中以 P0 优先级(这是最高优先级)处理此问题:https://issuetracker.google.com/issues/64527520

Google is handling this issue with priority P0 (this is TOP priority) in this issue: https://issuetracker.google.com/issues/64527520

与此同时,@edgars 解决方法为我解决了问题.谢谢!

In the meantime, @edgars workaround made it for me. Thanks!

更新 2:已修复,计划下一个测试版 "修复将登陆插件 3.0.0-beta2"

Update 2: Fixed, scheduled for next beta "Fix will land in plugin 3.0.0-beta2"

更新:由 Google 员工分享的其他解决方法:

Update: additional workaround shared by a Googler:

临时解决方法是将 min sdk 版本设置为低于 19.问题是 Desugar 将处理 API 19+ 的 try-with-resources,尽管平台支持它,但我们不会打包这些类.

Temporary workaround is to set min sdk version below 19. Issue is that Desugar will process try-with-resources for API 19+, although platform supports it, but we will not package those classes.

更新 3:如果不在 Java 代码中使用 Java 8 功能,请禁用它(这对 Kotlin 代码库也很有用).请参阅此评论.

Update 3: if not using Java 8 features in Java code, disable it (this can also be useful for Kotlin codebases). See this comment.

这篇关于RxJavaPlugins 错误找不到类“com.google.devtools.build.android.desugar.runtime.ThrowableExtension"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:在项目“应用程序"中,已解决的 Google Play 服 下一篇:Android Wear 应用程序打包失败

相关文章

最新文章