简体   繁体   中英

Gradle sync failed: Unable to start the daemon process

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.

奇怪的是,就我而言,重新启动计算机每次都可以正常工作。

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(ie 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM