open gradle.properties file and add the line "org.gradle.jvmargs=-Xmx2048M"
Add this line to gradle properties file
org.gradle.jvmargs=-Xms128m -Xmx1024m -XX:+CMSClassUnloadingEnabled
android {
//snip
//add this into your existing 'android' block
dexOptions {
javaMaxHeapSize "4g"
}
//snip
}
set _JAVA_OPTIONS=-Xms1024m -Xmx2048m -Dawt.useSystemAAFontSettings=lcd