Multidex (方法数超过限制的处理)

报错 : 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.解决了

:

 

 

 

  

posted @ 2017-07-24 14:10  吾问为何  阅读(231)  评论(0编辑  收藏  举报