Home » Android » How to connect to my http://localhost web server from Android Emulator in Eclipse

How to connect to my http://localhost web server from Android Emulator in Eclipse

Posted by: admin March 10, 2020 Leave a comment


What can I do in Eclipse’s Android emulator to connect it to my localhost web server page at http://localhost or

I’ve tried it, but the emulator still takes my request like a Google search for localhost or worse it says that it didn’t found the page while my web server is normally running.

How to&Answers:

The localhost refers to the device on which the code is running, in this case the emulator.

If you want to refer to the computer which is running the Android simulator, use the IP address instead. You can read more from here.


Use for default AVD and for .


I used successfully on my home machine, but at work, it did not work. After hours of fooling around, I created a new emulator instance using the Android Virtual Device (AVD) manager, and finally the worked.

I don’t know what was wrong with the other emulator instance (the platform was the same), but if you find does not work, try creating a new emulator instance.


Try where 8080 is your port number. It worked perfectly. If you just try it won’t work. You need to add port number to it. Also if Microsoft IIS has been installed try turning off that feature from control panel (if using any windows os) and then try as given above.


according to documentation: – Special alias to your host loopback interface (i.e., on your development machine)

check Emulator Networking for more tricks on emulator networking.


For My Mac OS mountain Lion device :


Works perfect !


I needed to figure out the system host IP address for the emulator “Nox App Player”. Here is how I figured out it was

  1. Installed Android Terminal Emulator from the app store
  2. Issue ip link show command to show all network interfaces. Of particular interest was the eth1 interface
  3. Issue ifconfig eth1 command, shows net as
  4. Begin pinging addresses starting at, got a hit on `′. Not sure if a firewall would interfere but it didn’t in my case

Maybe this can help someone else figure it out for other emulators.


If you are in windows you can go to simbol system and write ipconfig and check what ip is assigned to your machine.


Another workaround is to get a free domain from no-ip.org and point it to your local ip address.
Then, instead of using http://localhost/yourwebservice you can try http://yourdomain.no-ip.org/yourwebservice


I do not know, maybe this topic is already solved, but when I have tried recently do this on Windows machine, I have faced with lot of difficulties.
So my solution was really simple. I have downloaded this soft
http://www.lenzg.net/rinetd/rinetd.html followed their instructions about how to make port forwarding and then successfully my android device connected to make asp.net localhost project and stopped on my breaking point.

my rinetd.conf file: 1234 1234 82 82

Where is my localhost ip, 82 and 1234 my ports
Also I have craeted bath file
for easy life yournameofbathfile.bat, put that file inside rinedfolder. My bath file:

rinetd.exe -c rinetd.conf

After starting this soft, start your aps.net server and try to access from android device or any device in your local network(for example Computer ABC starts putty) and you will see that everything works. No need to go to router setting or do any other complicated things.
I hope this will help you. Enjoy.