当我执行“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。
我找不到有关此错误的任何信息,想知道它可以给我一些灵感,谢谢!
答案 0 :(得分:7)
尝试重新启动守护程序。也许它因某种原因被杀了
gradle --stop && gradle clean build
答案 1 :(得分:1)
我通过安装OpenJDK Hotspot JVM版本8解决了我的问题。以前,我使用的是OpenJDK OpenJ9 JVM版本11。不知道是因为我是从V11到V8,还是从OpenJ9到Hotspot。
答案 2 :(得分:0)
对我来说,它与GRADLE_HOME环境变量有关。我没有设置GRADLE_HOME。
这些步骤可能会有所帮助:
答案 3 :(得分:0)
我将gradle文件夹放到了家里
Class2
对我有用。
答案 4 :(得分:0)
cd android && gradlew clean && cd .. && react-native run-android
从项目根目录中单击此命令。
答案 5 :(得分:0)
我只是删除守护程序文件,只需在〜/ .gradle / daemon 中查找相应的版本并将其删除
答案 6 :(得分:0)
就我而言,这只是缺少堆内存。
我尝试通过手动启动守护程序来找出原因
gradle --daemon
这产生了以下错误消息:
Error occurred during initialization of VM
Could not reserve enough space for object heap
答案 7 :(得分:0)
对我来说(Cordova / Ionic项目),停止清洁没有用,因为在构建中未正确使用Gradle Daemon。我的机器上也安装了IBM JRE,就像我的Environment PATH变量一样。
因此,我在Android Studio中打开了android文件夹,构建成功,但是出现此警告。 表示Gradle Daemon正在使用“ 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"
建立成功!