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
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 in app\src\main\java\com\google\devtools\build\android\desugar\runtime
(you have to create those folders).
Update (still working in Gradle plugin 3.0.0-beta5, confirmed by @ TmTron)
classpath 'com.android.tools.build:gradle:3.0.0-beta5'
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:
classpath 'com.android.tools.build:gradle:3.0.0-beta4'
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:
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.
Update 3: if not using Java 8 features in Java code, disable it (this can also be useful for Kotlin codebases). See this comment.