com.android.dex.DexIndexOverflowException: Cannot merge new index XXXXX into a non-jumbo instruction

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_27623401/article/details/80362531

编译报错:

com.android.dex.DexIndexOverflowException: Cannot merge new index XXXXX into a non-jumbo instruction

之类的报错的话,多半是由于项目中引入的库多而且太大,这些模块需要生成一个Dex放进AAR包里给App使用,现在这个Dex生成不了了,提示太大,就是这个原因。

解决办法:

在Module的build.gradle文件的android节点中的defaultConfig节点添加:multiDexEnabled true即可。

android {
    compileSdkVersion 26
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId "  "
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true  //Howard 2017-08-31 解决方法数超过65536的问题

    }
}

猜你喜欢

转载自blog.csdn.net/qq_27623401/article/details/80362531