I have a ionic project. The app was build and run in my android phone successfully before. But suddenly from someday, when I run command "ionic cordova run android" I get the build error as below:
Execution failed for task ':transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
I have tried "cordova clean" to synchronise the cordova plugin. But it doesn't work..
How to solve this problem?
Open gradle.properties
under your project root directory and add/modify below line to
org.gradle.jvmargs=-Xmx3536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError
Specifies the JVM arguments used for the daemon process. The setting is particularly useful for tweaking memory settings. Change -Xmx3536m
to a larger value if this still does not meet your requirement.
And, modify your module level build.gradle
android {
...
dexOptions {
javaMaxHeapSize "2g"
}
...
}
Add this in your build.gradle file-
dexOptions {
javaMaxHeapSize "4g"
}
also you could follow -
Android Studio Google JAR file causing GC overhead limit exceeded error