2

Every other time I launch my app in an AVD I get this happy little error popping up:

Error running app:
Unable to open debugger port (localhost:8611): java.net.ConnectionException "Connection refused"

(would have posted a screenshot, but my reputation does not allow it)

It doesn't break anything, and after a couple relaunches it's back on track, but it's starting to annoy me. Does anyone know how to fix this? And I'm looking for a permanent fix, not a fix that would require me to do ten things over and over again every time this happens

Android Studio version 1.5.1 on Debian 8.2 using Oracle's java 1.8.0_66.

Also, to clarify, this is not an issue with my code. I can launch a completely empty project and still get this error popping up to say hi.


Running adb start-server in a standalone terminal yields the following:

cytodev@GE72-2QE:~$ adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

This uses a different port than the debugger port Android Studio uses, but I'm guessing that is normal.

cytodev
  • 87
  • 1
  • 6

1 Answers1

2

There is an issue around IP v6 and how localhost is handled. To fix the problem you will need to modify host file - see instruction. (I don't deal much with Linux but I think it's similar configuration for both Windows and Linux)

Windows (Must open with administrator permission)

  1. locate host file - C:\Windows\System32\Drivers\etc\hosts
  2. uncomment (remove #) the following line: # ::1 localhost

Linux (Must open with root)

  1. locate host file - /etc/hosts
  2. either add or uncomment ::1 localhost to the configuration file
Apirak Lunla
  • 647
  • 7
  • 5
  • Forcing a loopback of `::1` to `localhost` did not fix the issue as of just now, I will need some additional time along with reboots to confirm it. As far as your Linux instructions go, you're not at all far off. Debian does not have a commented line for `::1` but it was spot on. – cytodev Jan 27 '16 at 20:50
  • 1
    It's been awhile, but this did not fix it for me. – cytodev Mar 04 '16 at 13:18