I can not figure out how to access localhost from a Genymotion android emulator. By the way, Im using MAMP.
As a graphics/game developer, I find Genymotion unparalleled for running OpenGL code - on Genymotion it runs much smoother framerate wise, than using an x86+HAXM+HW GPU android emulator. Also, the integration of Google Apps/Services in Genymotion is fantastic.
You can access your host machine with the IP address "10.0. 2.2". This has been designed in this way by the Android team. So your webserver can perfectly run at localhost and from your Android app you can access it via "http://10.0.2.2:8080".
Update
After genymotion update to 2.2 you can use 10.0.3.2
, ref
Another approach
To access your localhost through Genymotion is using your PC IP address. to get your IP address go to:
start -> cmd -> ipconfig
then search for IPv4, copy the IP and paste it in your URL. It should looks like the following:
String YourURL = "http://192.168.0.106:8888/your_script_location.php";
Hope this works too for you, give me a feedback.
P.S: if it didn't work, turn off the firewall and any anti-virus application you have in your PC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With