您的位置:首页 > 运维架构

Duplicate files copied in APK META-INF/DEPENDENCIES File

2017-07-19 09:03 447 查看
今天调试 Android 应用遇到这么个问题:

Duplicate files copied in APK META-INF/DEPENDENCIES File 1: httpmime-4.3.2.jar File 2: httpmime-4.3.2.jar

貌似说两个包里面的文件重复了还是怎么的,谷歌了一番之后据说应该是 android studio 自身的bug

解决办法:

打开项目下面的 build.gradle 文件,在 android 代码块中添加下面代码

[sql] view plain copy print?android {
packagingOptions {
exclude ’META-INF/DEPENDENCIES’
exclude ’META-INF/NOTICE’
exclude ’META-INF/LICENSE’
exclude ’META-INF/LICENSE.txt’
exclude ’META-INF/NOTICE.txt’
}
}
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
}


将这些文件全部排出掉就ok了
但不知道这么做会不会有什么隐患,还是有其他更好的解决办法

可以参考下这篇文章:http://stackoverflow.com/questions/20853094/gradle-and-android-studio-duplicate-file-copied-from-same-jar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐