5

I have created many projects without any problem but today i keep getting the following error when I create a new one

Gradle 'MyApplication' project refresh failed
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 https://docs.gradle.org/2.14.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 1572864KB object heap

Any ideas about what is wrong?

Jared Rummler
  • 37,824
  • 19
  • 133
  • 148
Giannis
  • 121
  • 2
  • 4
  • 13
  • 1
    Follow this [link](http://stackoverflow.com/questions/25009717/android-studio-gradle-project-unable-to-start-the-daemon-process-initializatio). It'll solve your problem. – Vishal Puri Sep 22 '16 at 18:23

1 Answers1

24

You encounter following error:

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

This means the JVM hasn't enough memory space. Adding following property in the gradle.properties file will fix your problem:

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m
Fleur
  • 241
  • 1
  • 2
  • CORRECT ANSWER HERE! – Julian Sep 24 '16 at 00:39
  • 1
    Firstly thank you for help. When i added this and it works org.gradle.jvmargs=-Xmx156m -XX:MaxPermSize=512m . But it seems i have to edit the gradle.properties file every time i create a new project cause when i create a new project it has this value org.gradle.jvmargs=-Xmx1536m . Can i permanently edit the file so I don't have to edit it every singe time? – Giannis Sep 25 '16 at 13:39
  • @GiannisKosmas yes is the short answer ... look into D:\Android\sdk\tools\templates ... this might help http://stackoverflow.com/questions/24546484/how-to-create-custom-project-template-in-android-studio – CrandellWS Sep 29 '16 at 07:42