After upgrading Android Studio 3.0 Beta 1 getting the following error. When I downgraded the error disappeared.
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)
Update (still working in Gradle plugin 3.0.0-beta5, confirmed by @ TmTron)
Update (fix in Gradle plugin 3.0.0-beta4)
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:
Update (regression in AS 3.0 Beta 3)
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
Fixed in future beta 4, pending to be released.
Thanks @yvolk for reporting it and @ghui-zhang for the confirmation.
Final Update (fix in AS 3.0 Beta 2)
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.
So, the solution is to upgrade the plugin from 3.0.0-beta1 to at least 3.0.0-beta2.
History
Google is handling this issue with priority P0 (this is TOP priority) in this issue: https://issuetracker.google.com/issues/64527520
In the meantime, @edgars workaround made it for me. Thanks!
Update 2: Fixed, scheduled for next beta "Fix will land in plugin 3.0.0-beta2"
Update: additional workaround shared by a Googler:
Update 3: if not using Java 8 features in Java code, disable it (this can also be useful for Kotlin codebases). See this comment.
This issue is back on Android Studio 3.0.1. New Google thread is https://issuetracker.google.com/issues/77591528.
Please star the thread if you are still having this issue and post what you are running into.
I also encountered the same error after upgrading to AS 3.0 Beta 1 and found a workaround: I made a copy of the
ThrowableExtension.java
file from Google's sources and put it inapp\src\main\java\com\google\devtools\build\android\desugar\runtime
(you have to create those folders).