gradle 无法将消息分派到守护程序

vbopmzt1  于 2022-11-24  发布在  其他
关注(0)|答案(9)|浏览(361)

当我执行“gradle assembleRelease”时,有时会出现错误:

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

Gradle版本为2.7。
我找不到任何关于这个错误的信息,想知道它能给予我一些启发,谢谢!

72qzrwbm

72qzrwbm1#

尝试重新启动守护程序。可能由于某种原因它已被终止
gradle --stop && gradle clean build

jrcvhitl

jrcvhitl2#

对我来说,它是关于GRADLE_HOME环境变量。我没有设置GRADLE_HOME。
以下步骤可能会有所帮助:
1.指向高级系统设置-〉环境变量
1.创建名为“GRADLE_HOME”的环境变量
1.给予您的gradle文件的地址(您可以在用户-〉您的用户名-〉.gradle -〉GRADLE_VERSION(例如:4.4),或者如果您在这里没有找到它,您可以从https://services.gradle.org/distributions/下载一个,并在提到的路径中提取它,然后为GRADLE_HOME变量给予它的目录地址。

zazmityj

zazmityj3#

我通过安装OpenJDK Hotspot JVM版本8解决了我的问题。之前我使用的是OpenJDK OpenJ9 JVM版本11。不确定是因为我从V11升级到了V8还是从OpenJ9升级到了Hotspot。

h7appiyu

h7appiyu4#

我把Gradle的文件夹掉在家里

rm -Rf ~/.gradle

对我很有效。

txu3uszq

txu3uszq5#

在我的例子中,这只是缺乏堆内存。
我通过尝试使用以下命令手动启动守护进程来找出原因

gradle --daemon

这会产生下列错误消息:

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

du7egjpx6#

cd android && gradlew clean && cd .. && react-native run-android从项目根目录点击此命令。

x7yiwoj4

x7yiwoj47#

我只是删除了守护程序文件,只需在 ~/.gradle/daemon 中查找相应的版本并将其删除即可

gwbalxhn

gwbalxhn8#

对我(Cordova/Ionic Project)来说,停止清理不起作用,因为Gradle Daemon在构建中没有被正确使用。我在我的机器上也安装了IBM JRE,就像在我的环境PATH变量中一样。
因此,我在Android Studio中打开了Android文件夹,构建成功,但出现了此警告。Gradle守护程序正在使用“C:\Program Files\Android\Android Studio\jre”,并出现了几个警告,说明未使用PATH中设置的JRE。
所以为了我 cordova 项目我不得不这样做

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

而且建造成功!

kiz8lqtg

kiz8lqtg9#

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

org.gradle.jvmargs=-Xmx4608m

相关问题