Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

test the localhost in android emulator

My web application runs in localhost server. In my emulator the URL is http://localhost:8080/myaction

Is it possible to retrieve the information from the server?

like image 771
saravanan Avatar asked Feb 10 '10 05:02

saravanan


People also ask

Can I access localhost from Android emulator?

If you're using Android Studio to run the emulator, then localhost of your host computer will be mapped to the IP address, 10.0. 2.2 , inside the emulator. If you're using other programs to run the emulator, then you may need to consult the documentation associated with those programs.

How do I connect my local host to my emulator?

Use 10.0. 2.2 to access your actual machine. As you've learned, when you use the emulator, localhost ( 127.0. 0.1 ) refers to the device's own loopback service, not the one on your machine as you may expect.

How can I check my localhost mobile site?

After gathering the IP address and the port number, enter the URL in the format IP address: port number, and you will be able to access the local website on the mobile device/devices.

How do I access localhost?

To access the server from itself, use http://localhost/ or http://127.0.0.1/ . To access the server from a separate computer on the same network, use http://192.168.X.X where X.X is your server's local IP address. You can find the sever's local IP address (assuming it's Linux) by running hostname -I . 127.0.


1 Answers

Localhost is device's own loopback interface, if you're trying to access your development machine use 10.0.2.2.

More about it here.

like image 75
Nikola Smiljanić Avatar answered Oct 02 '22 23:10

Nikola Smiljanić