5

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.
samoz
  • 56,849
  • 55
  • 141
  • 195
  • Blocked by your firewall? VirtualBox configuration issue? – Jerry101 Jan 26 '15 at 00:04
  • I'm running on the localhost and bare metal. It's just setting the source of the conneciton from 10.0.0.45, rather than 127.0.0.1. – samoz Jan 26 '15 at 03:06
  • If you can init that Receiver instance with allowRemote=true, that would allow these connections. http://gradle.org/docs/current/userguide/build_environment.html#sec:gradle_configuration_properties mentions some daemon properties. – Jerry101 Jan 26 '15 at 05:51

5 Answers5

2

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.

Community
  • 1
  • 1
Patrick
  • 21
  • 1
  • 2
1

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.

Jerry101
  • 12,157
  • 5
  • 44
  • 63
1

As the log shows, the gradle daemon listens on the loopback interfaces (ipv4 and ipv6):ipv4/ipv6

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]]

The error message shows, that the connection came from the address 10.0.0.45, which is not allowed to connect:

[org.gradle.messaging.remote.internal.inet.TcpIncomingConnector] Cannot accept connection from remote address /10.0.0.45.

See https://stackoverflow.com/a/32777685/982303 for possible solutions.

Community
  • 1
  • 1
st0ne
  • 4,165
  • 2
  • 23
  • 24
1

If you happened to code on a Gaming laptop with Killer Wireless 1535, I suggest turning off the Killer Double Shot Pro in Killer Command Center. This works for me!!

Nam Nguyen
  • 11
  • 1
0

Uninstalling Killer Control Center & Driver was the solution.

Markus Schmidt
  • 442
  • 5
  • 4