解決問題有3步
步驟1
在app module中的build.gradle中添加依賴
implementation 'com.android.support:multidex:1.0.3'
步驟2
在app module中的build.gradle中的defaultConfig中添加以下代碼
multiDexEnabled true
步驟3
如果你自定義了Application需要在類中重寫一個方法
/**
* 重寫此方法
* @param base
*/
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// 主要是添加下面這句代碼
MultiDex.install(this);
}
