Test to see if it works when your PC is not connected to the net (no WiFi, no network cables). If it does work under those conditions, then it may be that you need to make sure that addresses are resolving to localhost
properly. The messages that DDMS and adb.exe use for debugging and communicating to the VM must properly resolve to localhost
on your PC. (Yes, it's odd that other commands using DDMS & adb work just fine but debugging doesn't. Seems that something in DDMS or adb needs to be standardized so they all work under the same conditions.)
If you need to make sure that things are resolving to localhost
properly:
1) Make sure that this line is in your /Windows/System32/drivers/etc/hosts
file:
127.0.0.1 localhost
(you can have any amount of whitespace between "127.0.0.1" and "localhost")
2) If that doesn't work, then you may need to also add your PC's IPv4 address to the hosts file, and resolve it to localhost
. (You can find out the IPv4 address for your machine with the ipconfig
command.) If, for example, your machine's IPv4 address is 192.168.1.100
then you'd add the line
192.168.1.100 localhost
to your hosts file. (You can add it below the "127.0.0.1 localhost" line in the file.)
You can verify that adb (and your emulator if you're running one) is listening on ports by using the netstat -b
command. (Note that you need admin privileges for the -b
option. I open a command window using "Run as Administrator.")