2

I am new to Android development and Java but after successfully installing Android Studio and the JDK, managing to create my first app and test it both in the emulator and on a phone now whenever I open Android Studio I get the following Message:

Gradle sync failed: 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/3.3/userguide/gradle_daemon.html
        Please read the following process output to find out more:
        -----------------------
        Consult IDE log for more details (Help | Show Log)

I have searched this site and extensively on Google and so far all suggested solutions I have found have failed.

I am using Android Studio 2.3.3 and JDK 1.8.0_131.

So far I have tried:- Uninstalling both Android Studio and the JDK, deleting any folders left behind and then re-installing both.

  1. Deleting the .gradle folder from C:\Users\$username$.
  2. Changing the Build Process Heap Size to 1024.
  3. Invalidating all caches and restarting multiple times.
  4. Double checking and even Triple checking the paths to the JDK and Android SDK.
  5. Ensuring that I have no extra open programs/windows and background apps in case it was a memory shortage issue suggested in some posts.

I am still at a loss as to how to fix this problem and open to any suggestions. Thank you.

SheffSlacker
  • 21
  • 1
  • 3
  • Is there anything helpful in the IDE logs (click Show Log)? What does your gradle.properties look like? Have you tried all of the suggestions in this related question: https://stackoverflow.com/questions/25009717/android-studio-gradle-project-unable-to-start-the-daemon-process-initializatio ? – Doug Simonton Jun 17 '17 at 23:02
  • @DougSimonton Thank you for your link. I went through all the solutions again one by one as I had tried so many things with different suggested variables it was hard to remember what I had tried. I have now found that although I had made sure Android Studio and the JDK are allowed through my firewall, if I turn off the firewall, it works!. I cant however see any entry in the firewall rules to permit or block gradle. Any suggestions on how to get Android Studio to work with the firewall on would be greatly appreciated. I use Bullguard Internet Security. – SheffSlacker Jun 18 '17 at 10:02
  • Apparently Gradle only accepts connections from the loopback interfaces. There are some suggested solutions starting here: https://stackoverflow.com/a/32777685/982303 – Doug Simonton Jun 25 '17 at 14:04
  • I have a similar (maybe same) problem, also android studio 2.3.3 and JDK1.8.0_131, windows10 and bullguard AV, do you by any chance have solved yours? The log file in my daemon folder says `java.net.SocketException: Permission denied: listen` as cause for the error. – voiDnyx Jun 28 '17 at 15:00
  • @voiDnyx I also use Bullguard and as mentioned above found that it was their firewall causing my issue. Turned off the firewall and it worked fine. Unfortunately I have not been able to find out what settings to adjust or exceptions to create in Bullguard to allow Android Studio to work properly but have been able to overcome the problem by disabling any network connections, then turning off Bullguard Firewall and then running AS. Then once running, turn the firewall back on and re-enable the network adapter. Its low tech but works for me!. – SheffSlacker Jul 26 '17 at 21:21
  • [This answer](https://stackoverflow.com/a/69630720/2289835) was useful for me. – Rumit Patel May 03 '23 at 09:40

3 Answers3

3

Strangely, restarting the computer worked for every single time in my case.

Arun
  • 154
  • 1
  • 12
0

Sheff Do Following steps:

1.Start Android Studio.

2.Close any open project.Go to File > Close

3.Project.(Welcome window will open) Go to Configure > Settings.

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.

The Solution Worked for me

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

Both method is same but you said new to Android studio so I give both suggestions..if any doubt text me

  • Thanks for offering the two methods for a soloution. I have tried both ways and unfortunately am still getting the same error. – SheffSlacker Jun 18 '17 at 09:17
  • I was using my computer as a hotspot .From another post solution I stopped the hotspot it solved the problem for me. May be you can try. – Achsah Jul 24 '18 at 10:33
0

If this affects a single project, it can be due to a missing gradle.properties or gradle-wrapper.properties file.

Try these defaults in the project directory

gradle.properties

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=false
android.nonTransitiveRClass=true
android.enableR8.fullMode=true
android.buildTypes.release.ndk.debugSymbolLevel = SYMBOL_TABLE

and

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Iain Ballard
  • 4,433
  • 34
  • 39