I have an application where I have local unit tests ( test folder ) and instrumentation unit test cases ( androidTest folder ). Right now if I click on the androidTest folder, and click "Run All Tests", it throws the following exception.
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexIndexOverflowException: field ID not in [0, 0xffff]: 65536
Error:Execution failed for task ':news-app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2
This exception is clearly because of hitting the multidex limit. But I have enabled multi-dex
for debug build. I guess when the instrumentation test cases are run, they are run in debug mode. Then why is this exception occuring?
I am attaching the build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion 22.0.1
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
applicationId "com.xyz"
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
multiDexEnabled true
}
release {
minifyEnabled true
shrinkResources true
multiDexEnabled false
}
}
lintOptions {
warning 'InvalidPackage', 'GradleCompatible'
}
dexOptions {
preDexLibraries true
incremental true
jumboMode = true
javaMaxHeapSize "4g"
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire