Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt

Duplicate files copied in APK META-INF/LICENSE.txt

解决办法

android { packagingOptions { exclude 'META-INF/LICENSE.txt' }
}

logcat: 日志 Error:Execution failed for task

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE.txt
    File1: …….jar
    File2: …….jar

有可能还会遇到其他的类似问题
这里写图片描述
下面是全部的解决办法 只需要找到对应的就可以把它exclude进去就解决了

android { packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' }  
}  

你可能感兴趣的:(android,Studio)