解决问题有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);
    }

  

相关文章: