How to connect to a localhost web server at http://localhost
or http://127.0.0.1
in the Android emulator page? < /p>
I've tried this but the emulator still accepts my request just like a Google search for localhost, or worse it says it wasn't found when my webserver is up and running page.
Use
10.0.2.2
as the default AVD and10.0.3.2
asgenymotion.Localhost refers to the device the code is running on, in this case the emulator.
If you want to reference the computer running the Android emulator, use the IP address10.0.2.2.
You can read more informationhere.