71

When I was running the gradle clean command, I got the following message

Starting a Gradle Daemon, 1 busy and 6 stopped Daemons could not be reused, use --status for details

For the investigation, I run the following command.

$ gradle --status
   PID STATUS   INFO
 11506 BUSY     4.3.1
  8027 STOPPED  (stop command received)
  9347 STOPPED  (stop command received)
 11727 STOPPED  (by user or operating system)
  4786 STOPPED  (by user or operating system)
 14569 STOPPED  (by user or operating system)
 31237 STOPPED  (by user or operating system)

Only Daemons for the current Gradle version are displayed. See https://docs.gradle.org/4.3.1/userguide/gradle_daemon.html#sec:status

So, some questions have arisen in my mind.

  1. How can I stop an existing daemon?

  2. How to kill daemon process?

SkyWalker
  • 28,384
  • 14
  • 74
  • 132

7 Answers7

56

Stopping an existing Daemon:

If you want to explicitly stop running Daemon processes for any reason, just use the command gradle --stop.

Note: for your consideration the gradle --stop command won’t stop daemons running with a different version of Gradle.

How to kill all Daemon process on my machine?

Gradle will kill any Daemon that has been idle for 3 hours or more, so you don’t have to worry about cleaning them up manually.

Resource Link: Gradle Daemon Issue Details

So the command and output are given below:

$ gradle --stop
Stopping Daemon(s)
2 Daemons stopped

After stopping daemons, status will be look like below:

$ gradle --status
No Gradle daemons are running.
   PID STATUS   INFO
  8027 STOPPED  (stop command received)
  9347 STOPPED  (stop command received)
 12448 STOPPED  (stop command received)
 11506 STOPPED  (stop command received)
 11727 STOPPED  (by user or operating system)
  4786 STOPPED  (by user or operating system)
 14569 STOPPED  (by user or operating system)
 31237 STOPPED  (by user or operating system)

If you are stuck with gradle build running, you can to through this post: Stuck with Gradle Build Running

Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
SkyWalker
  • 28,384
  • 14
  • 74
  • 132
  • 13
    You haven't answered the implied question, which is how do you get rid of the STOPPED daemons sitting around on your machine. On my Mac machines I eventually wind up with hundreds of STOPPED daemons. Gradle needs a "--purge" command to get rid of these. – Stevey Oct 14 '20 at 19:48
  • 1
    @Stevey Thanks for your comments. I have tried to figure out the issues. It will clarify everyone's concern what is actually happening underneath. We all know that removing `.gradle` folder can solve all issues. The intellect people also remove only 2 files version-wise `~/.gradle/daemon/5.5/registry.bin` and `~/.gradle/daemon/5.5/registry.bin.lock` for their solution. If there are multiple versions, need to remove multiple times. – SkyWalker Sep 27 '22 at 04:06
28

I solve it with another method in other post. By removing folders like 4.4 4.6 5.4.1 5.5 in directory as below

/users/[username]/.gradle/daemon

java.lang.OutOfMemoryError: GC overhead limit exceeded

Kyo Kurosagi
  • 2,177
  • 1
  • 18
  • 18
3

My problem solved only by changing gradle version from:

App\android\gradle\wrapper\gradle-wrapper.properties

old: distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
new: distributionUrl=https://services.gradle.org/distributions/gradle-6.9-all.zip

  • 1
    This happend because a new folder is created in: /users/[username]/.gradle/daemon for each gradle version to store the deamons information. You changed to a new versión and a new folder was created, but the old one still is there with the busy threads. – David B.F. Mar 03 '23 at 08:20
3

just reboot ur computer then go to .gradle folder and delete the daemon folder

ptito
  • 31
  • 1
2

For linux users

step 1 : cd ~ && rm -rf .gradle

step 2 : cd <to flutter working project directory>

step 3 : flutter run -v then kill process with ctrl+c .gradle dir will be created in /home/<user>/.gradle/wrapper/dists/gradle-<version>-all/9uukhhbclvbegdvsww0j0cr3p

step 4 : download gradle zip version on official website

step 5 : copy and paste the downloaded gradle inside /home/<user>/.gradle/wrapper/dists/gradle-<version>-all/9uukhhbclvbegdvsww0j0cr3p

step 6 : run flutter run -v

step 7 : everything is ok

wohlstad
  • 12,661
  • 10
  • 26
  • 39
0

Just add two lines in your app -> Gradle Scripts -> gradle properties

org.gradle.daemon=true

org.gradle.parallel=true
HandyPawan
  • 1,018
  • 1
  • 11
  • 16
-1

I created a new flutter project and migrated the previous data to the new folder, now it's working perfectly

Happy coding guys...

Steven
  • 23
  • 8