26
2017
09

Android学习笔记(二十四):导入包后导致的包冲突问题

问题描述:

因为要用到httpClient的http请求,所以需要导入相关的包,httpclient-4.5.3.jar、httpcore-4.4.6.jar等等; 结果导入后,提示多个文件冲突,如下图所示; ![报错截图](http://img.blog.csdn.net/20170925144750145?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSmFsb24yMDE1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)

解决办法:

参考自:https://stackoverflow.com/questions/33923461/how-do-i-resolve-duplicate-files-copied-in-apk-meta-inf
在build.gradle文件中的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' }
上一篇:使用Myeclipse创建一个简单的maven项目 下一篇:Axure8.0汉化包+注册码