Android Studio DexIndexOverflowException:方法 ID 不在 [英] Android Studio DexIndexOverflowException: method ID not in

查看:24
本文介绍了Android Studio DexIndexOverflowException:方法 ID 不在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Android Studio 开发应用程序时遇到了这个错误,我不知道如何解决.

I use Android Studio to develop an application and I face this error which I have no idea how to solve.

com.android.dex.DexIndexOverflowException: 方法 ID 不在 [0, 0xffff] 中

com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]

:app:lintVitalRelease
:app:prePackageMarkerForRelease
:app:transformClassesWithDexForRelease FAILED
Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
Information:BUILD FAILED
Information:Total time: 34.783 secs
Information:1 error 

推荐答案

尝试在 build.gradle 中启用 multiDex:

Try to enable multiDex in build.gradle:

android {

    defaultConfig {
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

这篇文章可能有帮助:更新后的DexIndexOverflowException问题到最新的 appcompat 和支持库

这篇关于Android Studio DexIndexOverflowException:方法 ID 不在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆