Blog Archive

Android emulator localhost issue - Can't connect to localhost or

Http connection to your local Tomcat or Apache server not working when using the Android emulator

This was really painful as I wasted hours figuring out why my Android emulator can't connect to or localhost. I wrote a Servlet in Tomcat that was running on localhost port 8080 and I could get it from the Browser or Eclipse window. But when I reference that in my Android Activity it was not working.

Here is the fix:
Just switch the localhost or to

Why we need this fix? is the emulated system's own loopback interface, not the one running on
your host development machine. within the Android system, one should use which is an alias specifically setup to contact your host