1. 依赖
compile 'com.android.support:multidex:1.0.1'
2.在 defaultConfig 增加
defaultConfig { applicationId "com.wbkj.roadtohealth" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" multiDexEnabled true }、
3. 增加这些dexOptions { //incremental = true; preDexLibraries = false javaMaxHeapSize "4g" }4.如果继承了application 则重写方法@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this) ; }如果没有继承,则在AndroidManifest.xml 中的<application /> 中添加android:name="android.support.multidex.MultiDexApplication"