Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Gradle Could not reserve enough space for object heap

I've installed Android Studio 1.1.0. I haven't done anything yet like start new Android application or import anything. Somehow it is trying to build something and it throws sync error.

Error:Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html

Please read the following process output to find out more:


Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.

I've already checked at gradle.org/.../gradle_daemon.html but couldn't find anything that helps me to solve the problem.

It isn't a memory problem because I've 8GB of physical memory and no other program running.

like image 312
GummDev Avatar asked May 05 '15 06:05

GummDev


2 Answers

For Android Studio 1.3 : (Method 1)

Step 1 : Open gradle.properties file in your Android Studio project.

Step 2 : Add this line at the end of the file

org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m 

Above methods seems to work but if in case it won't then do this (Method 2)

Step 1 : Start Android studio and close any open project (File > Close Project).

Step 2 : On Welcome window, Go to Configure > Settings.

Step 3 : Go to Build, Execution, Deployment > Compiler

Step 4 : Change Build process heap size (Mbytes) to 1024 and Additional build process to VM Options to -Xmx512m.

Step 5 : Close or Restart Android Studio.

SOLVED - Andriod Studio 1.3 Gradle Could not reserve enough space for object heap Issue

like image 132
Faiz Siddiqui Avatar answered Oct 06 '22 00:10

Faiz Siddiqui


in gradle.properties, you can even delete

org.gradle.jvmargs=-Xmx1536m 

such lines or comment them out. Let android studio decide for it. When I ran into this same problem, none of above solutions worked for me. Commenting out this line in gradle.properties helped in solving that error.

like image 21
Kashyap Kotak Avatar answered Oct 05 '22 23:10

Kashyap Kotak