Gradle not working on a clean Android Studio 2.2.3 install


(Bruce Kahn) #1

I just installed Android Studio 2.2.3 on my desktop but cannot get it to build even an “Empty” new project. As soon as I finish with the new project wizard I see the Gradle Build message for a long while then I see:

Gradle ‘MyApplication’ project refresh failed
Error: The first result from the daemon was empty. Most likely the proess died immediately after connection.

I Googled for that and found most reports were due to needing proxy settings corrected or with Android Studio 1.x and not using JDK 8. I’m at home so there is no proxy server and I am using 2.2.3, not 1.x (and JDK 7 is no longer supported) so none of the solutions work for me.

I have tried simply running Gradle from a command prompt and have not been able to get it to work. I find that a simple gradle init fails because a connection to the daemon cannot be completed on the loopback address. From the gradle init -debug output:

C:\Users\Dada\AndroidStudioProjects\MyApplication\gradle\wrapper>“java.exe” “-Dorg.gradle.appname=gradle” -classpath "c:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\bin…\lib\gradle-launcher-2.14.1.jar"
org.gradle.launcher.GradleMain init -debug
21:21:56.995 [DEBUG] [org.gradle.internal.nativeintegration.services.NativeServices] Native-platform posix files is not available. Continuing with fallback.
21:21:57.073 [DEBUG] [org.gradle.internal.nativeintegration.filesystem.services.FileSystemServices] Using JDK 7 file service org.gradle.internal.nativeintegration.filesystem.jdk7.WindowsJdk7Symlink
21:22:05.996 [LIFECYCLE] [org.gradle.launcher.daemon.client.SingleUseDaemonClient] To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14.1/user
guide/gradle_daemon.html.
21:22:06.011 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Using daemon args: [C:\Program Files\Java\jdk1.8.0_111\bin\java.exe, -Xmx1536m, -Dfile.encoding=windows-1252, -Duser.country=US, -Duser.langua
ge=en, -Duser.variant, -cp, C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\lib\gradle-launcher-2.14.1.jar]
21:22:06.011 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Starting daemon process: workingDir = C:\Users\Dada.gradle\daemon\2.14.1, daemonArgs: [C:\Program Files\Java\jdk1.8.0_111\bin\java.exe, -Xmx15
36m, -Dfile.encoding=windows-1252, -Duser.country=US, -Duser.language=en, -Duser.variant, -cp, C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\lib\gradle-launcher-2.14.1.jar, org.gradle.launcher.daemon.boots
trap.GradleDaemon, 2.14.1]
21:22:06.027 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process ‘Gradle build daemon’. Working directory: C:\Users\Dada.gradle\daemon\2.14.1 Command: C:\Program Files\Java\jdk1.8.0_111\bin\java.exe
-Xmx1536m -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -cp C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\lib\gradle-launcher-2.14.1.jar org.gradle.launcher.daemon.bootst
rap.GradleDaemon 2.14.1
21:22:06.027 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Environment for process ‘Gradle build daemon’: {PROCESSOR_LEVEL=6, FP_NO_HOST_CHECK=NO, SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, PROCESSOR_
ARCHITECTURE=AMD64, ANDROID_HOME=C:\Users\Dada\AppData\Local\Android\sdk, PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules, SystemDrive=C:, GS_PROG=C:\Program Files\gs\gs9.05\bin\gswin64c.exe, =ExitCode=0
0000000, DIRNAME=c:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\bin, USERNAME=Dada, JDK_HOME=C:\Program Files\Java\jdk1.8.0_111, CMD_LINE_ARGS=init -debug, ProgramFiles(x86)=C:\Program Files (x86), APP_HOM
E=c:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\bin…, VXIPNPPATH64=C:\Program Files\IVI Foundation\VISA, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, NIEXTCCOMPILERSUPP=C:\Program File
s (x86)\National Instruments\Shared\ExternalCompilerSupport\C, ProgramData=C:\ProgramData, ProgramW6432=C:\Program Files, HOMEPATH=\Users\Dada, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 26 Stepping 5, GenuineIntel, Pr
ogramFiles=C:\Program Files, PUBLIC=C:\Users\Public, EMC_AUTOPLAY=C:\Program Files (x86)\Common Files\Roxio Shared\OEM, windir=C:\Windows, AMDAPPSDKROOT=C:\Program Files (x86)\AMD APP, =::=::, _SKIP=2, LOCALAPPDATA=C:
\Users\Dada\AppData\Local, USERDOMAIN=Oliver3, LOGONSERVER=\OLIVER3, PROMPT=$P$G, =C:=C:\Users\Dada\AndroidStudioProjects\MyApplication\gradle\wrapper, APPDATA=C:\Users\Dada\AppData\Roaming, JAVA_EXE=java.exe, CommonPro
gramFiles=C:\Program Files\Common Files, Path=c:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\bin;.;c:\bin\nttools;c:\bin\tools;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD APP\bin\x86;C:\W
indows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;c:\Program Files\WIDCOMM\Bluetooth Software;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Python27, OS=Windows_NT
, COMPUTERNAME=OLIVER3, JD2_HOME=C:\Apps\JDownloader 2.0, PROCESSOR_REVISION=1a05, BURN_AUTOPLAY=C:\Program Files (x86)\Roxio\oem\Roxio Burn, CLASSPATH=c:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\bin…
\lib\gradle-launcher-2.14.1.jar, CommonProgramW6432=C:\Program Files\Common Files, DEBUG=1, ComSpec=C:\Windows\system32\cmd.exe, APP_BASE_NAME=gradle, SystemRoot=C:\Windows, TEMP=C:\Users\Dada\AppData\Local\Temp, HOMEDRI
VE=C:, USERPROFILE=C:\Users\Dada, TMP=C:\Users\Dada\AppData\Local\Temp, RCAUTOPLAY=C:\Program Files (x86)\Roxio\OEM\Roxio Central 5, CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files, NUMBER_OF_PROCESSORS=8}
21:22:06.027 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
21:22:06.027 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: Gradle build daemon.
21:22:06.782 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
21:22:06.782 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled…
21:22:06.782 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'Gradle build daemon’
21:22:06.782 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Gradle daemon process is starting. Waiting for the daemon to detach…
21:22:06.782 [DEBUG] [org.gradle.launcher.daemon.bootstrap.DaemonOutputConsumer] Starting consuming the daemon process output.
21:22:07.846 [DEBUG] [org.gradle.launcher.daemon.bootstrap.DaemonOutputConsumer] daemon out: Daemon started. About to close the streams. Daemon details: 01000433383732002435356634313461642d653066322d343432392d396132322d3
53133316166383639313637d589b5e07d1641f08eb199dc33abbb2c00005a2200000002000000047f00000100000010000000000000000000000000000000010037433a5c55736572735c446164615c2e677261646c655c6461656d6f6e5c322e31342e315c6461656d6f6e2d333
837322e6f75742e6c6f67
21:22:07.861 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: DETACHED
21:22:07.861 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process ‘Gradle build daemon’ finished with exit value 0 (state: DETACHED)
21:22:07.861 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Gradle daemon process is now detached.
21:22:07.861 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] An attempt to start the daemon took 1.85 secs.
21:22:07.861 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Started Gradle daemon DaemonStartupInfo{pid=3872, uid=55f414ad-e0f2-4429-9a22-5131af869167, address=[d589b5e0-7d16-41f0-8eb1-99dc33abbb2c po
rt:23074, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], diagnostics={pid=3872, daemonLog=C:\Users\Dada.gradle\daemon\2.14.1\daemon-3872.out.log}}
21:22:07.908 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface Software Loopback Interface 1
21:22:07.908 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddressFactory] Is this a loopback interface? true
21:22:07.924 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddressFactory] Is this a multicast interface? true
21:22:07.924 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddressFactory] Adding loopback address /127.0.0.1
21:22:07.924 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddressFactory] Adding loopback address /0:0:0:0:0:0:0:1
21:22:07.924 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddressFactory] Adding loopback multicast interface Software Loopback Interface 1
21:22:07.924 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface WAN Miniport (SSTP)

21:22:08.048 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
21:22:08.048 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
21:22:08.111 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
21:22:08.111 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Attempting to connect to [d589b5e0-7d16-41f0-8eb1-99dc33abbb2c port:23074, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]].
21:22:08.111 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /127.0.0.1.
21:22:08.111 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Cannot connect to address /127.0.0.1, skipping.
21:22:08.111 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /0:0:0:0:0:0:0:1.
21:22:08.111 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Cannot connect to address /0:0:0:0:0:0:0:1, skipping.
21:22:08.111 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{pid=3872, address=[d589b5e0-7d16-41f0-8eb1-99d
c33abbb2c port:23074, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], idle=false, lastBusy=1482898927846, context=DefaultDaemonContext[uid=55f414ad-e0f2-4429-9a22-5131af869167,javaHome=C:\Program Files\Java\jdk1.8.0_111,daemo
nRegistryDir=C:\Users\Dada.gradle\daemon,pid=3872,idleTimeout=120000,daemonOpts=-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]}
21:22:08.111 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: [d589b5e0-7d16-41f0-8eb1-99dc33abbb2c port:23074, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]]
21:22:08.111 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
21:22:08.111 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
21:22:08.126 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
21:22:08.126 [ERROR] [org.gradle.BuildExceptionReporter]
21:22:08.126 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
21:22:08.126 [ERROR] [org.gradle.BuildExceptionReporter]
21:22:08.126 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
21:22:08.126 [ERROR] [org.gradle.BuildExceptionReporter] Could not connect to the Gradle daemon.
Daemon uid: 55f414ad-e0f2-4429-9a22-5131af869167 with diagnostics:
Daemon pid: 3872

I did find a similar report in another thread post ( Cannot create or import any gradle project ). In that case the failure was due to Windows Defender messing things up and switching to another firewall fixed it. I run Kaspersky and have disabled it but still am not able to get Gradle to connect to the daemon.

My system is running 64-bit Windows 7, Java 8 update 111 and has 24Gb of RAM (and a lot of disk space). Can anyone suggest ways to get Gradle to work before I take drastic measures like uninstalling my firewall entirely or trying to revert to JDK 8 update 71 or 72 does and crossing my fingers (or pulling out my hair)?

Bruce