I had the same unpleasant problem. I finally found something that works for me: make sure localhosts correctly resolved (and really explicit).
Check if it works when your development machine is not connected to the network (no Wi-Fi, no network cables). If it works under these conditions, perhaps you need to make sure that the addresses are correctly resolved on localhost . Messages that DDMS and adb.exe use to debug and communicate with the virtual machine must correctly resolve to localhost on your computer. (Yes, it is strange that other teams using DDMS and adb work fine, but debugging does not. It seems that something in DDMS or adb needs to be standardized so that they all work under the same conditions.)
If you need to make sure the localhost solution is correct:
1) Make sure this line is in the file /Windows/System32/drivers/etc/hosts [windows] (or etc/hosts [* nix]:
127.0.0.1 localhost
(you can have any number of spaces between "127.0.0.1" and "localhost")
2) If this does not work, you may also need to add the IPv4 address of your computer to the hosts file and allow it localhost . (You can find out the IPv4 address for your computer using the ipconfig command.) If, for example, your IPv4 address of your computer is 192.168.1.100 , you must add the line
192.168.1.100 localhost
to your hosts file. (You can add it under the line "127.0.0.1 localhost" in the file.)
I had (1) my host file, but it still did not work (unless my computer was connected to the network). I tried (2) to guess a little, and it worked for me.
BTW: you can verify that adb (and your emulator, if you use it) is listening on ports using the netstat -b command. (Note that in Win7, you need administrator rights for the -b option. I open the command window using the "Run as administrator" command.)
source share