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 10.0.2.2:portno
and finally you'll be able to see that server from your device.
source: https://stackoverflow.com/a/4779992/1932105
or this:
It is very simple
Turn on Wifi Hotspot of your android phone and connect your Laptop
with your phone.
Start your server at localhost (I am using wamp server)
Now open command prompt and enter ipconfig command you will get
following things
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
Copy this 192.168.43.76 in your mobile browser.
Note : Please set you network as "Home Network".
source: https://stackoverflow.com/a/15864222/1932105
please use the search next time.