当我运行Android工作室项目时,我得到以下gradle输出:
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
File1: C:\Users\Benas\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient-android\4.3.5.1\eecbb0b998e77629862a13d957d552b3be58fc4e\httpclient-android-4.3.5.1.jar
File2: C:\Users\Benas\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3\5b0002c5fb66867ca919be0fbd86de1cfaf76da7\httpmime-4.3.jar
我的build.gradle:
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient-4.3.jar"
}
如何解决重复输入问题?
答案 0 :(得分:2)
对于重复的Meta-Inf内容,您只需将其添加到您的gradle
即可packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
}
答案 1 :(得分:2)
添加此项以解决问题:
packagingOptions{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}