Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap

Error during initialization of VM Could not reserve enough space for 1572864KB object heap
The error occurred when the virtual machine initialization
could not have stored enough space for 1572864 KB Object heap

Java virtual machine (JVM) allocated more memory than the system had available, so there was not enough space allocated to the JVM to create objects
Solutions:
1. Modify gradle.properties file
to change -xmx1536m to -xmx512m, save, Rebuild

TIP:
-xmx is to set the memory size of the VM, if the program is very memory hungry, you need to set it with this parameter. 
-Xmx512m is the maximum amount of heap memory the JVM is allowed to allocate, on demand.
-cp is the classpath, the path to load classes

2, in the personal folder (C:/Users/username /. Gradle or ~ /. Gradle)) create gradle. The properties file, add

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m

Read More: