multidex多dex操作

随手记录
compile 'com.android.support:multidex:1.0.1'

创建build.gradle同目录 multidex-config.txt
格式:com/example/MyClass.class

buildType.release里写
multiDexKeepFile file('multidex-config.txt')

android{}里 配置
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}

defaultConfig里写
multiDexEnabled true

application里复写
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// 将MultiDex注入到项目中
MultiDex.install(this);
}

你可能感兴趣的:(multidex多dex操作)