I\'m able to access my laptop web server using the Android emulator, I\'m using 10.0.2.2:portno
works well.
But when I connect my real Android phone, th
Was running into this problem using several different localhost servers. Finally got my app up and running on the phone in seconds just by using the Python simple server. It only takes a few seconds so is worth a try before getting into any more complicated solutions. First, make sure you have Python installed. cmd+r
and type python
for Windows or $ python --version
in mac terminal.
Next:
cd
$ python -m SimpleHTTPServer 8000
Then just find the address of your host machine on the network, I used System Preferences/Sharing
on mac to find it. Tap that into your Android device and should load your index.html
and you should be good.
If not then the problem is something else and you may want to look into some of the other suggested solutions. Good luck!
* EDIT *
Another quick solution to try if you're using Chrome is the Web Server for Chrome extension. I found it a quick and super easy way to get access to localhost on my phone. Just make sure to check Accessible to local network
under the Options
and it should work on your cell without any problem.