Gradle Daemon could not be reused

HristoTotov picture HristoTotov · Aug 5, 2019 · Viewed 15.4k times · Source

I am trying to run a react native project but I see an error saying "Starting a Gradle Daemon, 14 busy and 1 incompatible and 2 stopped Daemons could not be reused, use --status for details" after which the terminal stays idle.

Hello, I've followed the steps outlined in the official react native docs for starting a new react native project. Everything went perfect until I ran the react-native run-android command with an emulator open. I got the following error:

"Starting a Gradle Daemon, 14 busy and 1 incompatible and 2 stopped Daemons could not be reused, use --status for details"

And then the application stayed in "IDLE" state and I could not get the react native application to show on the emulator.

So far I have tried every existing solution proposal on every blog/article I could find but none of them worked.

  1. I have tried to stop all gradle processes using gradle --stop.
  2. I have tried to delete the .gradle dir.
  3. I have tried to delete the .gradle/5.4.1/daemon files but I could not even find a daemon folder inside the gradle version folder.
  4. I have tried multiple times deleting the project and creating a new one with react-native init.
  5. I have tried not updating the gradle software which is suggested when opening a new project inside android studio.
  6. I have tried using a different phone for the emulator.

terminal output - https://imgur.com/zReGarB project folders - https://imgur.com/wsb3hC1

Answer

It's not an error, it's just a warning and your app started fine. The error means that there are no available cached Gradle processes (daemons) available. A Gradle daemon is available when it is:

  • idle

    An idle Daemon is one that is not currently executing a build or doing other useful work.

  • compatible

    A compatible Daemon is one that can (or can be made to) meet the requirements of the requested build environment. The Java runtime used to execute the build is an example aspect of the build environment. Another example is the set of JVM system properties required by the build runtime.

Some aspects of the requested build environment may not be met by an Daemon. If the Daemon is running with a Java 8 runtime, but the requested environment calls for Java 10, then the Daemon is not compatible and another must be started. Moreover, certain properties of a Java runtime cannot be changed once the JVM has started. For example, it is not possible to change the memory allocation (e.g. -Xmx1024m), default text encoding, default locale, etc of a running JVM.

Read more in the docs.

So your messages basically means that you have 14 occupied (non-idle) daemons and 2 non-compatible. Gradle just have to start a new daemon to execute your build!

P.S. I recommend you to kill those 14 processes with gradle --stop as that seems to be to much. I guess you've just started your app 14 times!