simon_w
simon_w

Reputation: 153

Could not dispatch a message to the daemon

when i execute "gradle assembleRelease",sometimes i get a error :

03:23:01.987 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
03:23:01.987 [ERROR] [org.gradle.BuildExceptionReporter] 
03:23:01.988 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
03:23:01.988 [ERROR] [org.gradle.BuildExceptionReporter] Could not dispatch a message to the daemon.
03:23:01.988 [ERROR] [org.gradle.BuildExceptionReporter] 
03:23:01.988 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
03:23:01.989 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.launcher.daemon.client.DaemonConnectionException: Could not dispatch a message to the daemon.
03:23:01.989 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.client.DaemonClientConnection.dispatch(DaemonClientConnection.java:72)
03:23:01.990 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:167)
03:23:01.990 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.client.SingleUseDaemonClient.execute(SingleUseDaemonClient.java:55)
03:23:01.990 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.client.SingleUseDaemonClient.execute(SingleUseDaemonClient.java:37)
03:23:01.990 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
03:23:01.990 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
03:23:01.991 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
03:23:01.991 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
03:23:01.991 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
03:23:01.991 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
03:23:01.992 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
03:23:01.992 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
03:23:01.992 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
03:23:01.992 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
03:23:01.992 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.Main.doAction(Main.java:33)
03:23:01.993 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
03:23:01.993 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
03:23:01.993 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
03:23:01.993 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
03:23:01.993 [ERROR] [org.gradle.BuildExceptionReporter]        at java.lang.reflect.Method.invoke(Method.java:606)
03:23:01.994 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
03:23:01.994 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
03:23:01.994 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
03:23:01.994 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.messaging.remote.internal.MessageIOException: Could not write message org.gradle.launcher.daemon.protocol.Finished@266bad10 to '/0:0:0:0:0:0:0:1:53366'.
03:23:01.994 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.messaging.remote.internal.inet.SocketConnection.dispatch(SocketConnection.java:111)
03:23:01.995 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.client.DaemonClientConnection.dispatch(DaemonClientConnection.java:63)
03:23:01.995 [ERROR] [org.gradle.BuildExceptionReporter]        ... 22 more
03:23:01.995 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: Broken pipe
03:23:01.995 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
03:23:01.996 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
03:23:01.996 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
03:23:01.996 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.nio.ch.IOUtil.write(IOUtil.java:51)
03:23:01.996 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
03:23:01.996 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.messaging.remote.internal.inet.SocketConnection$SocketOutputStream.flush(SocketConnection.java:236)
03:23:01.997 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.messaging.remote.internal.inet.SocketConnection.dispatch(SocketConnection.java:109)
03:23:01.997 [ERROR] [org.gradle.BuildExceptionReporter]        ... 23 more

the gradle version is 2.7.

I can't find any information about this error,Want to know about it can give me some inspiration,thanks!

Upvotes: 15

Views: 39842

Answers (10)

mayo
mayo

Reputation: 4105

In my particular case, my issue was related with ESET protection ESET Block Gradle After Update

The solution as described there was enabling the passthrough mode:

Our developers have tried to reproduce the issue according to your instructions to no avail.

Does the issue go away after running the following?

sudo /Applications/ESET\ Endpoint\ Security.app/Contents/MacOS/fw --passthrough-mode 1

Eventually turn off the pass-through mode by running:

sudo /Applications/ESET\ Endpoint\ Security.app/Contents/MacOS/fw --passthrough-mode 0

A patch is planned for Dec 2024.

Upvotes: 0

Mond del Rosario
Mond del Rosario

Reputation: 11

it worked for me. just add this line on your gradlew.properties

org.gradle.jvmargs=-Xmx4608m

Upvotes: 1

minigeek
minigeek

Reputation: 3166

For me (Cordova/Ionic Project), stopping cleaning didn't work because Gradle Daemon was not being properly used in the build. I have IBM JRE also installed in my machine as in my Environment PATH variable.

So I opened android folder in Android Studio and build was success, but with this warning. that Gradle Daemon is using 'C:\Program Files\Android\Android Studio\jre' with couple of more warnings for not using JRE set in PATH.

so for my cordova project I had to this

cd platforms/android/ && gradlew.bat clean build -Dorg.gradle.java.home="C:\Program Files\Android\Android Studio\jre"

And build success!

Upvotes: 0

sparebytes
sparebytes

Reputation: 13136

I solved my issue by installing the version 8 of the OpenJDK Hotspot JVM. Previously I was using version 11 of the OpenJDK OpenJ9 JVM. Not sure if it's because I went from V11 to V8 or from OpenJ9 to Hotspot.

Upvotes: 2

Boomer
Boomer

Reputation: 3731

In my case it was simply a lack of heap memory.
I found out the reason by trying to start the daemon manually with

gradle --daemon

That produced the following error message:

Error occurred during initialization of VM
Could not reserve enough space for object heap

Upvotes: 1

I just delete the daemon files, just look for the corresponding version in ~/.gradle/daemon and delete them

Upvotes: 0

Mani Kant Tiwari
Mani Kant Tiwari

Reputation: 441

cd android && gradlew clean && cd .. && react-native run-android Hit this command from Project root directory.

Upvotes: 0

Clairton Luz
Clairton Luz

Reputation: 2364

I drop the folder of gradle in my home

rm -Rf ~/.gradle

it's works for me.

Upvotes: 1

Mahdieh Shavandi
Mahdieh Shavandi

Reputation: 8645

for me it was about GRADLE_HOME environmental variable. I hadn't set GRADLE_HOME.

these steps might help:

  1. point to advanced system settings -> environmental variables
  2. make an environmental variable named "GRADLE_HOME"
  3. give the address of your gradle file (you can find it on Users -> YOUR_USER_NAME -> .gradle -> GRADLE_VERSION (like: 4.4) or if you didn't find it here, you can download one from https://services.gradle.org/distributions/ and extract it in the path mentioned and give it's directory address for the GRADLE_HOME variable.

Upvotes: 2

JBirdVegas
JBirdVegas

Reputation: 11443

Try restarting the daemon. Perhaps it was killed for some reason

gradle --stop && gradle clean build

Upvotes: 26

Related Questions