• Android编译异常` Cause: duplicate entry: META-INF/MANIFEST.MF`


    Android编译异常 Cause: duplicate entry: META-INF/MANIFEST.MF

    解决方案2: 治标又治本(暂无)

    解决方案1: 治标不治本(还原大法)

    1. 还原到classpath 'com.android.tools.build:gradle:3.4.2' 即可.

    参考资料

    问题详情

    1. 旧项目 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

    2. 升级到 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

    3. 报错详情

      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
      
  • 相关阅读:
    readonly
    cut
    finger
    ping fping
    chmod/chown/chgrp/chattr
    synchronized 和 volatile 比较
    volatile的适用场合
    volatile的适用场合
    细说Java多线程之内存可见性
    SDUT2139图结构练习——BFS——从起始点到目标点的最短步数
  • 原文地址:https://www.cnblogs.com/AsionTang/p/11929529.html
Copyright © 2020-2023  润新知