我正在将我的Android项目从Eclipse迁移到Android Studio。原始项目依赖于两个apache库:commons-io-2.4.jar和commons-codec-1.9.jar。
我已将这些jar文件复制到正确的libs目录并更新了build.gradle以反映这一点:
dependencies {
compile project(':aviarySDK')
compile project(':showcaseView')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/commons-cli-1.2.jar')
compile files('libs/httpclient-4.3.1.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/httpmime-4.3.1.jar')
compile files('libs/metadata-extractor-2.6.4.jar')
compile files('libs/tape-1.1.0.jar')
compile files('libs/commons-codec-1.9.jar')
compile files('libs/commons-io-2.4.jar')
}
当我尝试构建项目时,我收到重复错误消息:
Error:duplicate files during packaging of APK /Users/gkipnis/repos/floomitandroidclient/floomItNewCamera/build/outputs/apk/floomItNewCamera-debug-unaligned.apk
Path in archive: META-INF/LICENSE.txt
Origin 1: /Users/gkipnis/repos/floomitandroidclient/floomItNewCamera/libs/commons-io-2.4.jar
Origin 2: /Users/gkipnis/repos/floomitandroidclient/floomItNewCamera/libs/commons-codec-1.9.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
Error:Execution failed for task ':floomItNewCamera:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
File 1: /Users/gkipnis/repos/floomitandroidclient/floomItNewCamera/libs/commons-io-2.4.jar
File 2: /Users/gkipnis/repos/floomitandroidclient/floomItNewCamera/libs/commons-io-2.4.jar
Information:BUILD FAILED
Information:Total time: 3.144 secs
有人可以提供任何可能发生的事情的指示。
谢谢你, 加里基普尼斯
答案 0 :(得分:0)
根据错误消息的建议,将此部分添加到build.gradle
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}