I really don't know why all of a sudden this error has started appearing everytime I try to deploy an app. I wait for an hour and then an error is returned and the app doesn't get deployed. What can be done to resolve this error along with anything related to 'Dex'?
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
My gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "package name"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
In addition, I've noticed these code sections with my workspace.xml file, but don't know if they should be removed.
<ExternalTaskPojo>
<option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
<option name="name" value="transformClassesWithDexForDebug" />
</ExternalTaskPojo>
<ExternalTaskPojo>
<option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
<option name="name" value="transformClassesWithDexForDebugAndroidTest" />
</ExternalTaskPojo>
<ExternalTaskPojo>
<option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
<option name="name" value="transformClassesWithDexForRelease" />
</ExternalTaskPojo>
In your Gradle script, add this:
dexOptions {
javaMaxHeapSize "4g"
}
"4g" here means 4 GB of your computer's memory. Set it to whatever appropriate based on your computer's specification.