I am trying to start Android Studio and keep getting Gradle errors. Looking at the daemon logs, it seems like the daemon will only accept connections from an IPv6 connection or 127.0.0.1.
However, I don't know how to enable it to accept other connections nor use IPv6. I have tried to add IPv6 flags in various places to no avail.
Note that the code iterates over my network interfaces, but still only accepts 127.0.0.1 connections.
The error itself is from this portion of the Gradle code:
https://code-review.gradle.org/browse/Gradle/subprojects/messaging/src/main/java/org/gradle/messaging/remote/internal/inet/TcpIncomingConnector.java?r=6264564978680860f88e7a43659459f778546fe8#to104
Here is the log file:
17:49:57.451 [INFO] [org.gradle.launcher.daemon.server.Daemon] start() called on daemon - DefaultDaemonContext[uid=f2ffb085-b7ad-446a-983d-d6d47a3ae4c0,javaHome=/usr/lib/jvm/java-7-oracle,daemonRegistryDir=/home/whistlepig/.gradle/daemon,pid=7040,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
17:49:57.466 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] updating lastActivityAt to 1422226197466
17:49:57.477 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface vboxnet0
17:49:57.478 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
17:49:57.479 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a multicast interface? true
17:49:57.481 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote address /fe80:0:0:0:800:27ff:fe00:0%4
17:49:57.483 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote address /192.168.56.1
17:49:57.487 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote multicast interface vboxnet0
17:49:57.488 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface p10p1
17:49:57.489 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
17:49:57.491 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a multicast interface? true
17:49:57.492 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote address /169.254.8.98
17:49:57.493 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote multicast interface p10p1
17:49:57.494 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface p9p1
17:49:57.496 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
17:49:57.497 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a multicast interface? true
17:49:57.499 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote address /fe80:0:0:0:12c3:7bff:fe46:5caf%2
17:49:57.500 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote address /10.0.0.45
17:49:57.501 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding remote multicast interface p9p1
17:49:57.503 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface lo
17:49:57.504 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? true
17:49:57.505 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a multicast interface? false
17:49:57.507 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /0:0:0:0:0:0:0:1%1
17:49:57.508 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /127.0.0.1
17:49:57.515 [DEBUG] [org.gradle.messaging.remote.internal.inet.TcpIncomingConnector] Listening on [73551d2b-fa6b-4f37-8520-8694106b50e7 port:49792, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]].
17:49:57.521 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] Daemon starting at: Sun Jan 25 17:49:57 EST 2015, with address: [73551d2b-fa6b-4f37-8520-8694106b50e7 port:49792, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]]
17:49:57.523 [INFO] [org.gradle.launcher.daemon.server.DomainRegistryUpdater] Advertising the daemon address to the clients: [73551d2b-fa6b-4f37-8520-8694106b50e7 port:49792, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]]
...
[org.gradle.messaging.remote.internal.inet.TcpIncomingConnector] Cannot accept connection from remote address /10.0.0.45.
The Daemon is used not only to avoid the cost of starting the JVM for each build but also to cache information about the project structure, files, tasks, and more in memory. This makes the next compilations much faster.
The --daemon and --no-daemon command line options enable and disable usage of the Daemon for individual build invocations when using the Gradle command line interface. These command line options have the highest precedence when considering the build environment.
I had very similar problems with my new Android Studio installation. Spent the last 42 hours googling and trying all kinds of fixes. I'm so glad I didn't remove my firewall like some suggested - because the firewall log actually helped me diagnose the root cause of this problem - ie Android Studio was sending a message from a IPv4 socket to a IPv6 socket on a Gradle Java.exe process!
Having diagnosed the problem, it's a simple step to googling the right answer - in this post: https://superuser.com/questions/453298/how-to-force-java-to-use-ipv4-instead-ipv6
That fixed it for me.
This seems to be a known bug, according to https://code.google.com/p/android/issues/detail?id=82347
It gives a workaround which works for some people:
The only workaround for me is to use ipv6 instead of ipv4 : in bin/studio.vmoptions or bin/studio64.vmoptions (depending on if you are in 32 or 64 bits), change the line -Djava.net.preferIPv4Stack=true by -Djava.net.preferIPv6Stack=true
Also there might be a way to configure the daemon to allowRemote connections.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With