我使用以下链接中的说明从 Eclipse 导出我的项目并导入到 Android Studio:http://developer.android.com/sdk/installing/migrate.html
构建时出现错误:
Duplicate files copied in APK META-INF/DEPENDENCIES
经过搜索,找到了解决办法:添加
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
进入 build.gradle
。它有效!
但我不明白为什么会出现此错误以及为什么必须应用该修复程序。谁能解释一下?
最佳答案
虽然 Scott Barta 的回答是正确的,但缺少一个简单通用的解决方案:只需添加
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
到您的 build.gradle 以忽略这些重复项。
关于安卓工作室 : Duplicate files copied in APK META-INF/DEPENDENCIES when compile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27977396/