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

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

问题描述

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


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



 :app:lintVitalRelease 
:app:prePackageMarkerForRelease
:app:transformClassesWithDexForRelease FAILED
错误:任务':app:transformClassesWithDexForRelease'的执行失败。
> com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.dex.DexIndexOverflowException:方法ID不在[0,0xffff]中: 65536
信息:BUILD FAILED
信息:总时间:34.783秒
信息:1个错误


尝试在build.gradle中启用multiDex:

   android {

defaultConfig {
...

//启用multidex支持。
multiDexEnabled true
}
...
}

依赖项{
compile'c​​om.android.support:multidex:1.0.0 '
}

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


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: 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 

解决方案

Try to enable multiDex in build.gradle:

android {

    defaultConfig {
        ...

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

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

This article may helpful: DexIndexOverflowException issue after updating to latest appcompat and support library

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

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