gath gath - 6 months ago 37
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?


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.