产生原因:应用中的Dex 文件方法数超过了最大值64k的上限。
Error:The number of method references in a .dex file cannot exceed 64K.
解决方法:
在app的 build.gradle 中
(1)在dependencies 中添加
compile 'com.android.support:multidex:1.0.1'
(2)在 defaultConfig 中添加
multiDexEnabled true
(3)在你自己的application中,重写attachBaseContext方法:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}