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.
2
votes
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 permission
– Pedro 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 device
– Pedro 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