小言_互联网的博客

:app:transformClassesWithDexBuilderForDebug

1224人阅读  评论(0)

项目编译报错:

What went wrong:

Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.

> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process F:\project\work\AppFleet_Android\app\build\intermediates\transforms\proguard\debug\0.jar

 

项目中出现了这个问题,查看详细报错信息

 gradlew clean build --stacktrace

 

报错信息中有一段如下:

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process F:\project\work\AppFleet_Android\app\build\intermediates\transforms\proguard\debug\0.jar

       at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:805)

       at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$8(DexArchiveBuilderTransform.java:730)

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.

The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle

android {

    compileOptions {

        sourceCompatibility 1.8

        targetCompatibility 1.8

    }

}

See https://developer.android.com/studio/write/java8-support.html for details. Alternatively, increase the minSdkVersion to 26 or above.

 

解决方案:

在app的build.gradle中android节点下增加如下配置:

android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

 

 


转载:https://blog.csdn.net/gengbaolong/article/details/101785294
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场