Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

来源:互联网 发布:金华管家婆软件jhgjp 编辑:程序博客网 时间:2024/05/21 01:31

在使用jar包的时候编译运行时出现下面的错误

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: /项目地址/app/libs/httpclient-4.5.3.jar  

File2: /项目地址/app/libs/httpcore-4.4.7.jar


解决方法:

在app下的build.gradle文件中的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'}

以上的内容添加一下就可以了

阅读全文
0 0