Gradle Build Problems


#1

Hello everyone, so I’m trying to get a basic app going that is running off of Angular. I’ve built the basics, have the AVD working with the emulator, the emulator runs fine, and so far everything is going great. However, whenever I try to build the application everything works and green lights up until building gradle. Here is the stacktrace I’m getting with this:

Blockquote

  • Exception is:
    org.gradle.launcher.daemon.client.DaemonConnectionException: Could not dispatch a message to the daemon.
    at org.gradle.launcher.daemon.client.DaemonClientConnection.dispatch(DaemonClientConnection.java:68)
    at org.gradle.launcher.daemon.client.DaemonClientConnection.dispatch(DaemonClientConnection.java:35)
    at org.gradle.launcher.daemon.client.DaemonClientInputForwarder$ForwardTextStreamToConnection.endOfStream(DaemonClientInputForwarder.java:78)
    at org.gradle.launcher.daemon.client.InputForwarder$1.run(InputForwarder.java:95)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: org.gradle.internal.remote.internal.MessageIOException: Could not write ‘/127.0.0.1:59951’.
    at org.gradle.internal.remote.internal.inet.SocketConnection.flush(SocketConnection.java:121)
    at org.gradle.launcher.daemon.client.DaemonClientConnection.dispatch(DaemonClientConnection.java:59)
    … 8 more
    Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:51)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
    at org.gradle.internal.remote.internal.inet.SocketConnection$SocketOutputStream.writeWithNonBlockingRetry(SocketConnection.java:259)
    at org.gradle.internal.remote.internal.inet.SocketConnection$SocketOutputStream.writeBufferToChannel(SocketConnection.java:247)
    at org.gradle.internal.remote.internal.inet.SocketConnection$SocketOutputStream.flush(SocketConnection.java:241)
    at org.gradle.internal.remote.internal.inet.SocketConnection.flush(SocketConnection.java:119)
    … 9 more

I’ve deleted the .gradle folder in it’s entirety to check if there is a cache issue but to no avail. I’ve made sure to run this out of admin mode and in admin mode to try to see if it has to do with elevation rights but I get the same error on both fronts.


#2

So as the error mentions, something is force-ably closing the connection. Further investigation lead me to turn off one of my anti-virus/malware tools, Malware-bytes. I’m not sure as to why it was killing the connections Gradle was trying to make - but it was. After closing that program it finally built correctly. I’m assuming that other anti-virus/malware programs could do the same thing. Here is something to help troubleshoot for people that have a similar issue in the future:

Blockquote
C:\Users\there\Desktop\PHPProjects\basicdrawer\platforms\android>gradlew build --status
No Gradle daemons are running.
PID STATUS INFO
15344 STOPPED (by user or operating system)
10156 STOPPED (by user or operating system)
5892 STOPPED (by user or operating system)
11144 STOPPED (by user or operating system)
17784 STOPPED (by user or operating system)
17312 STOPPED (by user or operating system)
18980 STOPPED (by user or operating system)
2204 STOPPED (by user or operating system)
12012 STOPPED (by user or operating system)
15568 STOPPED (by user or operating system)

Only Daemons for the current Gradle version are displayed. See https://docs.gradle.org/3.3/userguide/gradle_daemon.html#sec:status

Blockquote

If everything is getting killed off there is something going on that is forceably doing so. Hope it helps.