Android编译异常` Cause: duplicate entry: META-INF/MANIFEST.MF`
目录
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: libs\leakcanary-android-1.5.4.aar. > duplicate entry: META-INF/MANIFEST.MF
作者:Asion Tang
凡是没有注明[转载]的文章,本Blog发表的文章版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。