gath gath - 1 year ago 66
Android Question

How can I access my localhost from my Android device?

Am able to access my laptop web server using the Android emulator, am using

works well.

But when I connect my real Android phone, the phone browser cannot connect to the same web server on my laptop. The phone is connected to the laptop using a USB cable. If I run the
adb devices command, I can see my phone.

What am I missing?

Answer Source

USB doesn't provide network to mobile device. If it's connected to your wifi, then hit your laptop address provided by the router. If it's connected to your mobile network, then first find out your router external IP address, then forward some port to that and finally you'll be able to see that server from your device.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download