报错 : Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

原因是项目的总方法数超过限制(>65536)

解决:在appModule下的guild文件下 dependencies 里面添加:

compile 'com.google.android:multidex:0.1'

在defaultConfig 里面添加:

multiDexEnabled true

并且在项目的Application里重写attachBaseContext()方法:

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
   MultiDex.install(this);
}
ok.解决了

:

 

  

04-19 22:20
查看更多