Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/mob/commons/logcollector/LogsCollector;
一日在新建Apk安装包时出现错误,提示:
含有一大串的文件错误提示,而第一个错误提示是因为包的重复引用,在要用到其他项目或者library时很容易出现,意思就是在你自己的项目中引用了某个包,而被你作为library的项目也引用了同一个包,就会有这个问题。
解决方法:
方法一
简单粗暴,直接在build.gradle文件下修改dependencies属性中的
compile fileTree(include: ['*.jar'], dir: 'libs')
把compile改为privided
provided fileTree(include: ['*.jar'], dir: 'libs')
然后点击一下右上角的Sync now刷新就好
方法二
点击Files -> Project Structure
在弹出窗口选择app -> Dependencies,把{include =[*.jar],dir = libs} 属性改为provided,点击OK等待刷新完毕就好