我开始使用新的更新Android 4.0.0并遵循在D8和R8中启用对java 8库的支持
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
和
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.6'
...
}
最后,我无法用以下错误构建我的应用程序:
Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.
欲了解更多情况:
> Task :app:compileNoExtensionsDebugSources UP-TO-DATE
> Transform artifact desugar_jdk_libs_configuration-0.12.0.jar (com.android.tools:desugar_jdk_libs_configuration:0.12.0) with L8DexDesugarLibTransform
Error: Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.
> Transform artifact databinding-common-4.0.0.jar (androidx.databinding:databinding-common:4.0.0) with DexingWithClasspathTransform
AGPBI: {"kind":"error","text":"Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.","sources":[{}],"tool":"D8"}
> Transform artifact multidex-2.0.1.aar (androidx.multidex:multidex:2.0.1) with DexingWithClasspathTransform
Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.
AGPBI: {"kind":"error","text":"Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.","sources":[{}],"tool":"D8"}
> Transform artifact kotlin-android-extensions-runtime-1.3.72.jar (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) with DexingWithClasspathTransform
AGPBI: {"kind":"error","text":"Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.","sources":[{}],"tool":"D8"}
Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.
我错过了任何配置吗?怎么解决这个问题?
发布于 2020-06-20 09:32:20
在将build.gradle
中的build.gradle
升级到com.android.tools:desugar_jdk_libs:1.0.6
之后,我遇到了同样的问题。我的应用程序一直很好,直到我进行了依赖性更新。两个小时前,当我经过build.gradle
时,一个建议出现了,我也跟着做了。
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.6'
}
我把依赖恢复到com.android.tools:desugar_jdk_libs:1.0.5
,这个问题神奇地消失了。
dependencies {
//noinspection GradleDependency
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.5'
}
从这个角度来看,我认为这很可能是一个与依赖项的新版本与IDE兼容的缺陷(我不知道,也许IDE更新之后可能会继续解决这个问题)。也许我们需要把这个问题报告给谷歌,我还没试过。:D
实际上,我刚刚创建了这个Stack溢出帐户,是为了在我寻找解决问题的方法时看到您的帖子后共享它。:)
更新
正如R8团队的@sgjesse所提到的,1.0.5
到1.0.6
的更改已经在1.0.7
发行版中恢复,以解决这个问题,因此1.0.5
和1.0.7
是完全相同的。更多细节见@sgjesse的回答。
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.7'
}
我转到了1.0.7
,以删除对过时的依赖版本的警告。:)
我不能对此发表评论,因为我还没有50名声誉。谢谢,@sgjesse!)
发布于 2020-06-22 12:05:49
tl:dr版本1.0.6
不适用于AGP 4.0.0
。使用1.0.7
或1.0.5
代替-它们是相同的。
版本1.0.6
是为了解决第158502561期问题而发布的,因为依赖的POM文件中有一个错误,只影响某些工具。然而,我犯了一个错误,1.0.6
最终与Android 4.0.0
不兼容,这就是1.0.7
发布的原因。1.0.5
和1.0.7
是相同的,1.0.8
将在稍后发布,以解决相关工件中的POM问题。
发布于 2020-07-05 11:03:45
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
稳定可用
https://stackoverflow.com/questions/62481928
复制相似问题