解决 Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this

      把之前在Eclipse做的一个android项目导入到了android studio,项目clean 和rebuid都没问题,但是运行时就报错Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this is  ,在在gradle console还出现一堆 Android Error - AGPBI: {“kind”:“error”,“text”: 

     开始看到这堆问题束手无策,后来发现The number of method references in a .dex file cannot exceed 64K这句话值得关注,于是觉得这问题很有可能是因为方法数超过了64k而导致的,果不其然,就是这个鬼。针对方法数超过64k这个问题,网上有多个解决办法:插件化、分包等,可以搜素看看。

所以如果有遇到Android Error - AGPBI: {“kind”:“error”,“text”: ...这种鬼东西,不一定是什么jar包引用重复导致的哦,在build.gradle注释掉compile fileTree(include: ['*.jar'], dir: 'libs')也不一定解决问题哦,这时候就请注意一下,Message gradle Build栏中的信息了,有可能是方法数超过64k而导致的。

解决 Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this_第1张图片

你可能感兴趣的:(解决 Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this)