Cannot fit requested classes in a single dex file (# methods: 66411 > 65536)


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

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM