Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’

Three errors: non zero exit value 1; non zero exit value 2; non zero exit value 3

Note that the dependent package, library dependent package and LIBS package should not be repeated

1.Error:Execution failed for task ‘: app:transformClassesWithDexForDebug ’.

com.Android.build . api.transform.TransformException : com.android.ide . common.process.ProcessException : org.gradle.process . internal.ExecException : Process ‘command ‘F:\Program Files (x86)\Java\jdk1.8.0_ 31\bin\ java.exe ” finished with non-zero exit value 1

This is because the dependency packages are duplicated (like V4 and nineoldandroids), as shown in the figure. The dependency on easeui is implemented in app, but the dependency on this package is added to both app and library files. So report this error, modify it and report it again, just clean and rebuild it

2.Error:Execution failed for task ‘: app:transformClassesWithDexForDebug ’.

com.android.build . api.transform.TransformException : com.android.ide . common.process.ProcessException : org.gradle.process . internal.ExecException : Process ‘command ‘F:\Program Files (x86)\Java\jdk1.8.0_ 31\bin\ java.exe ” finished withnon-zero exit value 2

This error is in the app’s build.Gradle Just add the following sentence to it.

android {

defaultConfig {
    ...
    multiDexEnabled true
}

}
3.Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘F:\Program Files (x86)\Java\jdk1.8.0_31\bin\java.exe” finished withnon-zero exit value 3

This error is added to the app.bulid, and then rebuild, and then run it again. 4g can be modified depending on the computer configuration (2g, 3g, 6g, 8g).

dexOptions {
    javaMaxHeapSize "4g"
}


Read More: