Android Studio Gradle project "Unable to start the daemon process /initialization of VM"

267,843

Solution 1

The Solution Worked:

    1.Open the projects gradle.properties file in android studio
    2.Added this line at end of file org.gradle.jvmargs=-Xmx1024m & Save the file
    3.Close & reopen the project or just Clean and re-Build it

Solution 2

Do Following steps:

  1. Start Android Studio.
  2. Close any open project.Go to File > Close Project.(Welcome window will open)
  3. Go to Configure > Settings.
  4. On Settings dialog,select Compiler (Gradle-based Android Projects) from left and set VM Options to -Xmx512m(i.e. write -Xmx512m under VM Options:) and press OK.

Where to put it

Solution 3

I had the same issue, it was because I had an existing ".gradle" folder and then I've played with the android studio version (and also with the Java jdk version) , and I guess it messed things up.

Solution: Remove the .gradle directory (mine's location was C:\Users\UserName\.gradle), and restart android studio. It will automatically create a new one.

Solution 4

For android studio 2.2 version VM option is not available directly from project structure.

steps to make gradle sync successful:->

1)OPEN project

2)Click on gradle script

3)open gradle.properties

4)Change org.gradle.jvmargs=-Xmx1536m to org.gradle.jvmargs=-Xmx1024m

5)Save the work

6)Open File->Invalidate cache/Restart

And its done!!!

Enjoy Android!!!

Solution 5

Open your project and press Ctrl + Alt + Shift + S to open Project Structure. There under JDK location check Use embedded JDK (recommended).

Share:
267,843
AsimRazaKhan
Author by

AsimRazaKhan

Experienced iOS Developer with a demonstrated history of working in the information technology and services industry. Skilled in Objective -C, Swift 3, Adaptive Layouts, Instruments, TestFlight, Certificates, Google Maps SDK, Firebase SDK, TypeScript, HTML, and JavaScript. Strong engineering professional with a Bachelor’s Degree focused in Computer Science from UOK.

Updated on February 10, 2022

Comments

  • AsimRazaKhan
    AsimRazaKhan about 2 years

    Version of Android Studio (Beta) 0.8.4
    OS version: Windows 8
    Java JRE/JDK version: 1.8.0_11

    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/1.12/userguide/gradle_daemon.html
    -----------------------
    Error occurred during initialization of VM
    Could not reserve enough space for 1048576KB object heap
    Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
    
  • AsimRazaKhan
    AsimRazaKhan over 9 years
    how can I unlink Gradle, Do I need to download Latest Gradle Update??
  • AsimRazaKhan
    AsimRazaKhan over 9 years
    unfortunately i have now downloaded the stable version of Android Studio and it is working gud :)
  • Ocean Airdrop
    Ocean Airdrop over 9 years
    This worked however my ".gradle" folder wasn't located under users. To find the location of of your ".gradle" folder, in Android Studio goto File->Settings and type "gradle" in the search box. You will be able to pick up the correct path there.
  • Ocean Airdrop
    Ocean Airdrop over 9 years
    One other thing. Gradle does not like UNC paths. So if your path starts with \\ you will need to move your ".gradle" dir to another location.
  • Sanjeev Kumar
    Sanjeev Kumar almost 9 years
    Open up your System Properties (The bit you had open before that shows your CPU/RAM values) >> On the left sidebar, click Advanced System Settings >> Click Environment Variables >> Under System Variables, press New >> Use the values below: // Variable name: _JAVA_OPTIONS // Variable value: -Xmx524M then, press OK and try again. restart Android Studio
  • PK Gupta
    PK Gupta over 8 years
    Not working, same error occurs. Android studio version 1.3.1
  • Sanket Prabhu
    Sanket Prabhu about 8 years
    Close & reopen the project is not mandatory, You can just CleanBuild it
  • Christopher J.
    Christopher J. almost 8 years
    What is the explanation for this ?
  • Kartik Watwani
    Kartik Watwani almost 8 years
    @Giru Bhai can you add a screenshot as to where exactly we have to write -Xmx512m
  • Surendar D
    Surendar D over 7 years
    In my android studio Compiler (Gradle-based Android Projects) not showing only.
  • Milan Kerslager
    Milan Kerslager about 7 years
    This is low level memory problem and also 32bit environment problem where is not possible to alocate so much memory for the heap. In your project check gradle.properties (and if needed use lower number org.gradle.jvmargs=-Xmx512m). This may be necessary if the project was created on 64bit system. Then set lower default in your Android Studio as mentioned below as it should take precedence (File > Close Project, then Configure > Settings -> Build, Execution, Environment > Android Compilers > VM Options > -Xmx512m).
  • Rakshit Nawani
    Rakshit Nawani almost 7 years
    I tried each and everything but your solution worked for me. Thanks
  • Georgios S.
    Georgios S. almost 7 years
    Thanks for letting me know, bear in mind that the same thing may happen again for newer updates (as program version changes) or when you run gradle commands from cmd. Make sure you whitelist your Android studio path in the containment settings and HIPS rules in Comodo.
  • NightFury
    NightFury over 6 years
    Worked for AS 3.0 beta 2. Thanks
  • King of Masses
    King of Masses over 6 years
    I am using android studio 2.3.3 and not able to see VM Options under the compiler. any help ?
  • Giru Bhai
    Giru Bhai over 6 years
    @KingofMasses Check here developer.android.com/studio/intro/studio-config.html for Customize your VM options
  • Clive Sargeant
    Clive Sargeant over 6 years
    this worked for me, i was previously increasing the heap which did not work. only worked when i decreased the heap. thanks for sharing.
  • Mitya
    Mitya over 6 years
    Your answer would be more helpful if you went into a little detail on HOW to safelist the process. I realise everyone uses a different AV, but what is the specific process to safelist? Thanks.
  • Georgios S.
    Georgios S. over 6 years
    @Utkanos I would suggest instead of wasting time and mind essence to make comments on how an answer -should- be to think a little bit beforehand or just ask politely...especially when such an easy answer is a google search away... check here or just press ctrl+alt+delete in Windows when android studio is running right click the Android Studio app and select "open file location" that will show you name and path of the file to whitelist :)
  • Mitya
    Mitya over 6 years
    @GiorgosS. - I'm afraid you've taken my comment too defensively. SO is ALL about questions and answers, and a voting system exists precisely because some answers are better than others. Comments are here to seek clarification and advise on how answers or questions could be improved. This really isn't controversial. Don't take things personally. It's just a plain fact - your answer would be better with the missing info.
  • Georgios S.
    Georgios S. over 6 years
    @Utkanos I think you misunderstood me,my original answer was to complement the existing content of the thread and my comment wasn't towards a personal defense but rather on a specific way of thinking. I absolutely agree on what you wrote about SO but "spoonfeeding" on certain trivial matters first and foremost doesn't apply for everyone's configuration and secondly doesn't help anyone learn on his own. So a complete guide would be even better than what you suggest but here would be out of scope. Therefore I prefer to link an answer to extend the info just in case someone is still in doubt :)
  • Mitya
    Mitya over 6 years
    Fair enough. We can agree to disagree.
  • Ali Khaki
    Ali Khaki almost 5 years
    my .gradle folder size is 5.2 Gbyte
  • Hossein Yousefpour
    Hossein Yousefpour over 4 years
    After Android Studio 3.5 update, In first open it suggest me to change JDK location as same as gradle. When I back to embedded JDK, The Problem solved!
  • Khagendra
    Khagendra about 3 years
    My problem still persists
  • sifr_dot_in
    sifr_dot_in over 2 years
    i had "org.gradle.jvmargs=-Xmx1024m" already; still had the issue. i resolved and answered;
  • sifr_dot_in
    sifr_dot_in over 2 years
    i added this after closing all projects; still had the issue. i resolved and answered;
  • sifr_dot_in
    sifr_dot_in over 2 years
    though i had tried this previously; still faced the issue. i resolved and answered;