解決問題有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); }