Error: duplicate files during packaging of APK E:\**\**\app-debug-unaligned.apk
Path in archive: META-INF/LICENSE.txt
Origin 1: E:\**\**\app\libs\httpmime-4.1.2.jar
Origin 2: E:\**\**\app\libs\commons-lang-2.6.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
File 1: E:\**\**\app\libs\httpmime-4.1.2.jar
File 2: E:\**\**\app\libs\httpmime-4.1.2.jar
* Try:
Path in archive: META-INF/LICENSE.txt
Origin 1: E:\**\**\app\libs\httpmime-4.1.2.jar
Origin 2: E:\**\**\app\libs\commons-lang-2.6.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
File 1: E:\**\**\app\libs\httpmime-4.1.2.jar
File 2: E:\**\**\app\libs\httpmime-4.1.2.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
从Eclipse 中迁移的一个项目,运行就报这个错误,网上查询后得到解决方法。在 app 项目的 build.gradle 中添加
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
。