您当前的位置: 首页 >  kotlin

蓝不蓝编程

暂无认证

  • 0浏览

    0关注

    706博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Android工程中方法数超过65536解决方法(Kotlin)

蓝不蓝编程 发布时间:2018-11-07 09:20:19 ,浏览量:0

Android Studio报错:

The number of method references in a .dex file cannot exceed 64K. Caused by: com.android.tools.r8.utils.AbortException: Error: Cannot fit requested classes in a single dex file (# methods: 68815 > 65536)

解决方案
  1. build.gradle文件android的defaultConfig里面增加multiDexEnabled true
  2. build.gradle文件dependencies里面增加implementation 'com.android.support:multidex:1.0.3'
  3. Application类中增加
  • kotlin写法
    override fun attachBaseContext(base: Context) {
        super.attachBaseContext(base)
        MultiDex.install(this)
    }
  • java写法
@Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
关注
打赏
1639405877
查看更多评论
立即登录/注册

微信扫码登录

0.0380s