Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access localhost from a Genymotion android emulator?

I can not figure out how to access localhost from a Genymotion android emulator. By the way, Im using MAMP.

like image 321
mownier Avatar asked Nov 28 '13 03:11

mownier


People also ask

Is Genymotion better than Android emulator?

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.

Does localhost work on Android?

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".


1 Answers

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.

like image 61
Coderji Avatar answered Sep 30 '22 20:09

Coderji