Android学习笔记--遇到Duplicate files copied in APK META-INF/LICENSE.txt

在修改老的项目中遇到的此问题,导入jar包的时候报

Error:Execution failed for task ':ADApplication:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: E:\banong\xinbanben\zhushiyun426\ADApplication\libs\httpclient-4.5.3.jar
File2: E:\banong\xinbanben\zhushiyun426\ADApplication\libs\httpcore-4.4.6.jar

后来百度了好就才发现好像是什么重复了,

解决方案如下:

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

喜欢可以帮到更多的人,

你可能感兴趣的:(Anndroid学习笔记)