Android Studio 4.0.0 Java 8 library desugaring in D8 and R8 Build Error

[tl:dr] Version 1.0.6 does not work with AGP 4.0.0. Use 1.0.7 or 1.0.5 instead - they are the same.

Version 1.0.6 was released to address issue 158502561, as there was an error in a dependent POM file, only affecting certain tools. However, I made a mistake, and 1.0.6 ended up being incompatible with Android Studio 4.0.0, which is why 1.0.7 was released. 1.0.5 and 1.0.7 are identical, and 1.0.8 will be released later to address the POM issue in the dependent artifact.


I encountered the same issue after I upgraded the coreLibraryDesugaring in build.gradle to com.android.tools:desugar_jdk_libs:1.0.6. My app was building fine until I did that dependency update. A suggestion popped up two hours ago when I passed by build.gradle and I just followed suit.

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.6'
}

I reverted the dependency back to com.android.tools:desugar_jdk_libs:1.0.5 and the issue magically disappeared.

dependencies {
    //noinspection GradleDependency
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.5'
}

From this, I think that it is likely a bug with the compatibility of the new version of the dependency with the IDE (maybe an IDE update may follow up to resolve the issue, I don't know). Maybe we need to report it as an issue to Google, I have not tried that yet. :D

Actually, I created this Stack Overflow account just now to share this after I saw your post when I searched for a solution to my problem. :)

Update

As mentioned by @sgjesse from the R8 team, the changes from 1.0.5 to 1.0.6 are already reverted in the release of 1.0.7 to fix this issue, so 1.0.5 and 1.0.7 are just the same. See @sgjesse's answer for more details.

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.7'
}

I moved to 1.0.7 to remove the warning on outdated dependency version. :)

P.S. I can't comment because I don't have 50 reputation yet. Thanks, @sgjesse! :)