SoFunction
Updated on 2025-04-04

Android Studio error solution when building

Android Studio appears when building transformClassesWithDexForDebug

Android Studio has the following problems when building:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> : 
.: :
 Process 'command 'D:\Java\jdk1.7.0_45\bin\'' finished with non-zero exit value 3

Confirm that the code is fine, the project is not wrong, but this problem will still occur after the rebuild is cleaned.

Some people say "I suspect that there is a compatibility issue with Gradle and JDK 1.8. Try to lower the JDK version of the project dependency to 1.7, try to compile again, succeed!", but this question did not work for me. Finally searched for a few minutes and finally found the solution, as follows:

Add in dexOptionsjavaMaxHeapSize “4g”,It can be solved

dexOptions {
// jumboMode true
 javaMaxHeapSize "4g"
 preDexLibraries = false
}

Thank you for reading, I hope it can help you. Thank you for your support for this site!