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'
}

 

posted @ 2015-09-01 13:44  wanqi  Views(2339)  Comments(0Edit  收藏