android - 意外的顶级异常 : com. android.dex.DexIndexOverflowException : method ID not in [0, 0xffff]:65536

标签 android android-studio andengine android-multidex

我的 Gradle 文件中有以下依赖项:

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "packagename"
        minSdkVersion 10
        targetSdkVersion 23
    }

    sourceSets {
        main {
            jni.srcDirs = []
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:23.0.1'
    compile files('libs/FLurry_3.2.2.jar')
    compile files('libs/pixel-perfect-collision.jar')
    compile files('libs/twitter4j-core-3.0.3.jar')
    compile project(':zip_file')
    compile project(':andEngine')
    compile project(':andEnginePhysicsBox2DExtension')
    compile project(':downloader_library')
    compile project(':viewPagerLibrary')
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'org.apache.commons:commons-lang3:3.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
}

在构建 gradle 文件时出现以下错误:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

为了解决这个错误,我已经添加了 multidex 依赖:

 compile 'com.android.support:multidex:1.0.1'

还在循环..

已编辑:问题已经解决,所以不要尝试复制它,解决方案如下..!!

希望得到帮助!

谢谢。

最佳答案

你应该添加

  multiDexEnabled true

build.gradle

defaultConfig {

    applicationId 'pkg'
    minSdkVersion 
    targetSdkVersion 
    versionCode 
    versionName 

    // Enable MultiDexing:  https://developer.android.com/tools/building/multidex.html
    multiDexEnabled true
}

关于android - 意外的顶级异常 : com. android.dex.DexIndexOverflowException : method ID not in [0, 0xffff]:65536,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32836059/

相关文章:

android - Android Studio Beta Channel、Android Studio Canary Channel、Android Studio Dev Channel 有什么区别?

android - 如何在 Android Studio 中显示工具提示描述?

android - 使用 if/if else/else 语句进行碰撞检测。如何提高?

android - 编译Android

android - 如何在 LoopEntityModifier 开始时随机设置 PathModifier 的坐标?

android - 加载 map 后出现 AndEngine 错误 : Invalid Index (onUpdate) FATAL EXCEPTION: UpdateThread

安卓 : Intent crashing the app

android - 如何在Kotlin Android Studio中制作可长时间单击的清除按钮

android - 在 Kotlin 中传递和使用函数作为构造函数参数

android - 如何获取 android NDK 详细崩溃报告?