Android解决Duplicate files copied in APK META-INF/LICENSE

来源:互联网 发布:高维数据可视化 编辑:程序博客网 时间:2024/05/29 04:22

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/LICENSE
File1: E:\android\TranslateVoice\app\libs\httpclient-4.5.3.jar
File2: E:\android\TranslateVoice\app\libs\httpcore-4.4.6.jar

解决方法:在build.gradle文件中android下添加packaginOptions.

packagingOptions{        exclude 'META-INF/NOTICE' // will not include NOTICE file        exclude 'META-INF/LICENSE' // will not include LICENSE file        exclude 'META-INF/DEPENDENCIES'        // as noted by @Vishnuvathsan you may also need to include        // variations on the file name. It depends on your dependencies.        // Some other common variations on notice and license file names        exclude 'META-INF/notice'        exclude 'META-INF/notice.txt'        exclude 'META-INF/license'        exclude 'META-INF/license.txt'    }
阅读全文
0 0