Could not start Gradle daemon

A few of our developers have reported an error when running gradle tasks. The exception below is returned - but unable to determine the cause.

Any hints as to the problem? Seems like this is failing on ‘String pidString = decoder.readNullableString();’

D:\arws\ddc41>gradlew.bat --stacktrace

FAILURE: Build failed with an exception.

 

* What went wrong:

Could not start Gradle daemon.

 

* Try:

Run with --info or --debug option to get more log output.

 

* Exception is:

org.gradle.api.GradleException: Could not start Gradle
daemon.

        at
org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:116)

        at
org.gradle.launcher.daemon.client.DefaultDaemonStarter.startDaemon(DefaultDaemonStarter.java:93)

        at
org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:105)

        at
org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:82)

        at
org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:115)

        at
org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:75)

        at
org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)

        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)

        at
org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:23

7)

        at
org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:21

0)

        at
org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)

        at
org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)

        at
org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)

        at
org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)

        at
org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

        at
org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

        at
org.gradle.launcher.Main.doAction(Main.java:33)

        at
org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at
java.lang.reflect.Method.invoke(Method.java:600)

        at
org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)

        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)

        at
org.gradle.launcher.GradleMain.main(GradleMain.java:23)

        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at
java.lang.reflect.Method.invoke(Method.java:600)

        at
org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)

        at
org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)

        at
org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)

Caused by: org.gradle.api.UncheckedIOException:
java.io.EOFException

        at
org.gradle.launcher.daemon.bootstrap.DaemonStartupCommunication.readDiagnostics(DaemonStartupCommunication.ja

va:100)

        at
org.gradle.launcher.daemon.bootstrap.DaemonGreeter.parseDaemonOutput(DaemonGreeter.java:40)

        at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:112)

        ... 31 more

Caused by: java.io.EOFException

        at
java.io.DataInputStream.readBoolean(DataInputStream.java:227)

        at
org.gradle.messaging.serialize.InputStreamBackedDecoder.readBoolean(InputStreamBackedDecoder.java:47)

        at
org.gradle.messaging.serialize.AbstractDecoder.readNullableString(AbstractDecoder.java:53)

        at
org.gradle.launcher.daemon.bootstrap.DaemonStartupCommunication.readDiagnostics(DaemonStartupCommunication.ja

va:85)
    ... 33 more

Problem appeared to be related to the JDK installed or otherwise installed incorrectly.

Does this mean the issue is resolved for you?

Yes, reinstalling the JRE resolved this problem.

I had the same problem with the same stacktrace. I was running the IBM Java 7 JDK/JRE. After updating to the latest IBM 7.1 JDK/JRE, the problem went away.

I used Gradle 2.4.