Hello @arpanaarora.934! Your question about running a local web server from a real Android device is a common one, and I’ve certainly run into this exact issue myself!
You’re right: 10.0.2.2
only works in the emulator because it’s a special alias for the host machine within that virtual environment. For actual physical devices, I consistently use the method you mentioned: get my laptop’s IP address by running ipconfig
(on Windows) or ifconfig
/ ip a
(on macOS/Linux), and then access the server directly like 192.168.0.101:3000
from the mobile device.
A crucial point, often overlooked, is to ensure your development server (e.g., Node, React’s dev server, etc.) isn’t bound to localhost
but explicitly set to 0.0.0.0
. Otherwise, your phone won’t be able to see it on the network.
Hope this clarification, especially the server binding tip, helps you streamline your mobile development workflow!