AndroidStudio使用第三方jar包报错(Error: duplicate files during packaging of APK)

http://www.kwstu.com/ArticleView/android_201410252131196692

错误描述:

Error: duplicate files during packaging of APK D:\work\workspace\XXXX\build\apk\XXX-debug-unaligned.apk

Execution failed for task ':XXXX:packageDebug'.

> Duplicate files copied in APK META-INF/LICENSE.txt
File 1: D:\work\workspace\ADControl\libs\fastjson-1.1.32.jar

File 2: D:\work\workspace\ADControl\libs\fastjson-1.1.32.jar

Error:: duplicate files during packaging of APK D:\work\workspace\XXX\build\apk\XXX-debug-unaligned.apk

Execution failed for task ':ADControl:packageDebug'.
> Duplicate files copied in APK META-INF/NOTICE.txt
File 1: D:\work\workspace\ADControl\libs\fastjson-1.1.32.jar
File 2: D:\work\workspace\ADControl\libs\fastjson-1.1.32.jar

解决方法:

在build.gradle的android节点添加

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

 

你可能感兴趣的:(AndroidStudio使用第三方jar包报错(Error: duplicate files during packaging of APK))