I'm able to access my laptop web server using the Android emulator, I'm using
But when I connect my real Android phone, the phone browser can't 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 both your desktop and phone are connected to the same WiFi (or any other local network), then use your desktop IP address assigned by the router (not
localhost and not
To find out the IP address of your desktop:
ifconfig | grep "inet " | grep -v 127.0.0.1will yield only the important stuff
If your phone is connected to the mobile network, then things are going to be harder.
Either go hardcore:
<your desktop IP>:<server port number>
It is actually quite simple.
localhost(I am using WAMP server for Windows)
Once you've done that, you will see something like the following:
Wireless LAN adapter Wireless Network Connection: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::80bc:e378:19ab:e448%11 IPv4 Address. . . . . . . . . . . : 192.168.43.76 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.43.1
Note: Please set your network as "Home Network". Setting the network as Home Network means that you are allowing your PC to share stuff with other devices on the same network.
If you are using Windows 10, this can be done with the following:
If you are having an issue, it is most likely to do with Windows Firewall.