2
votes

I have a server in xampp in os x laptop, when I type: 10.0.2.2/myphpServer in the emulator web navigator, goes ok, but from a usb-connected real android device, I can not connect.

3
Pls check if Internet permission set in Manifest file or not? If already, try using the real IP of your PC. 10.0.2.2 is used for emulator.BNK
Yes, manifest has Internet permissionPedro Gonzalez
Use real IP instead. Try access realIP/... from web browser in your phone. Check Network connection, firewall. And more, post your logcat :-)BNK
Have you solved this issue yet?BNK
solved. Used 10.0.2.2 for emulator and real IP for real android devicePedro Gonzalez

3 Answers

2
votes

Check public ip of your pc by ifconfig command in terminal then use YOUR_IP/myphpServer
If you are in local network (router or LAN) then use your local_ip/myphpServer (make sure your mobile is also in same network)

If your mobile doesn't have internet connection then go for Android USB Tethering

0
votes

You need to connect both device to same network to access localhost in Android device.

0
votes

Better use the IP Address of your laptop type in cmd ipconfig search for Local Area Connection: IPv4 Address