In an android project, build.gradle file, I have been through this line
dexOptions{ javaMaxHeapSize \"4g\" }
dexOptions{ javaMaxHeapSize "4g" }
after writing this in build.gradle go to gradle.propertiesand enable this line:
build.gradle
gradle.properties
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8