目录
Android编译异常 Cause: duplicate entry: META-INF/MANIFEST.MF
解决方案2: 治标又治本(暂无)
解决方案1: 治标不治本(还原大法)
- 还原到
classpath 'com.android.tools.build:gradle:3.4.2'
即可.
参考资料
问题详情
-
旧项目 AndroidStudio3.4 编译正常
classpath 'com.android.tools.build:gradle:3.4.2'
gradle/wrapper/gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip
-
升级到 AndroidStudio3.5 编译报错
classpath 'com.android.tools.build:gradle:3.5.2'
gradle/wrapper/gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
-
报错详情
Cause: duplicate entry: META-INF/MANIFEST.MF
Caused by: java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:232) at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109) at com.android.builder.packaging.JarMerger.write(JarMerger.java:252) at com.android.builder.packaging.JarMerger.addJar(JarMerger.java:199) at com.android.builder.packaging.JarMerger.addJar(JarMerger.java:156) at com.android.build.gradle.internal.dependency.AarToClassTransform$Companion.copyEntryTo(AarToClassTransform.kt:94) at com.android.build.gradle.internal.dependency.AarToClassTransform$Companion.copyAllClassesJarsTo(AarToClassTransform.kt:90) at com.android.build.gradle.internal.dependency.AarToClassTransform$Companion.access$copyAllClassesJarsTo(AarToClassTransform.kt:83) at com.android.build.gradle.internal.dependency.AarToClassTransform.transform(AarToClassTransform.kt:78) at org.gradle.api.internal.artifacts.transform.DefaultTransformer.transform(DefaultTransformer.java:173) at
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':EasyAndroid:javaPreCompileDebug'. > Could not resolve all files for configuration ':EasyAndroid:debugCompileClasspath'. > Failed to transform artifact 'leakcanary-android-1.5.4.aar (:leakcanary-android-1.5.4:)' to match attributes {artifactType=android-classes, org.gradle.usage=java-api}. > Execution failed for AarToClassTransform: libsleakcanary-android-1.5.4.aar. > duplicate entry: META-INF/MANIFEST.MF