I can not figure out how to access localhost from a Genymotion android emulator. By the way, Im using MAMP.
-
2You've mis-stated the question. "localhost" is never anything but the system on which your program is running, in this case that would refer to the emulated android device itself, which can of course be accessed at the address 127.0.0.1 Likely you are looking for a way to access a service running on the system *hosting* the emulator instead. – Chris Stratton Nov 28 '13 at 03:39
-
Ahm thanks for the comment. What i am aiming is that, i want to access the 'http://localhost:8888' in my computer, which is running MAMP, from a Genymotion android emulator. Is that possible? – mownier Nov 28 '13 at 03:57
10 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.
-
310.0.3.2 didn't work (connection refused) but the address given by Virtual Box vboxnet0 which was 192.168.56.1 in my case worked. – xji Nov 17 '14 at 05:11
-
2Damn, I didn't realise it changed from `10.0.2.2` to `10.0.3.2` after an update. Thanks for that! – twig Jun 24 '15 at 23:44
-
I changed only one digit in url ".setRootUrl("http://10.0.3.2:8080/_ah/api/")" and it worked for me! Great! – Alex Zezekalo Jul 02 '15 at 10:36
-
-
110.0.3.2 worked for me on OSx and Genymotion 2.8.1. A bit surprised I didn't even have to add anything to my Apache vhost configuration or hosts file, it just works! :D – Magnus Apr 03 '17 at 15:51
you need this structure
Genymotion
Default AVD
the http it's very important and the port it's for default It depends on your server.
you can check this url in your browser the smartphone

- 1
- 1

- 3,652
- 6
- 41
- 61
The IP returned by ipconfig
dit not work for me. However 10.0.3.2
worked for me even though the IP address in the Wifi setting is 10.0.3.15
.
Genymotion 2.2.0

- 11,964
- 19
- 90
- 142
-
1Thank you sir. With this IP I can connect to the computer hosting the Genymotion emulator regardless of the network I'm in. That's what I came looking for :D – josebama Jun 04 '14 at 10:55
-
Genymotion! It works for me using IP 10.0.3.2 but depends on your localhost port. Apache it will be just IP and Tomcat with default port 8080. Here I take screenshots.
1. Apache Screenshot
2. Tomcat Screenshot
Hope this is helpful. Thanks!

- 25,047
- 11
- 113
- 117
-
Am trying to follow all your steps but it doesn't seem to work... Any settings in VB??????????????? – Karue Benson Karue May 20 '16 at 19:17
-
@KarueBensonKarue, first make sure that your URLs executed in browser. – Madan Sapkota May 20 '16 at 19:52
Intro:
Long story short, Genymotion is running on Virtualbox, and the default network configuration is “Host-Only.” This method essentially emulates a physical network that is shared by your Genymotion VM (the emulator) and your host machine. The name of the network is vboxnet0, and if you run “ifconfig vboxnet0” (or “ipconfig vboxnet0” if running Windows) on your host machine, you should receive the IP address of your host on the vboxnet0 network. The default IP is most likely 192.168.56.1.
Solution:
This is the IP address to use when accessing your host machine from the Genymotion emulator. For my Rails app, this meant calling “192.168.56.1:3000” instead of “10.0.2.2:3000.”
Link:
http://bbowden.tumblr.com/post/58650831283/accessing-a-localhost-server-from-the-genymotion

- 594
- 1
- 6
- 18
-
In my experience, there was no need to use a port, just use the IP address. – ThomasW Mar 26 '14 at 06:08
- run xampp(def 127.0.0.1:80) and go to Control Panel\All Control Panel Items\Network and Sharing Center
- select connection

- 1,090
- 1
- 16
- 23
When i used genymotion in my ubuntu
i used the ip address of the virtual machine as local host and it worked .
in virtual box goto file > preferences > network > select host only network and select adapter tab copy the ipv4 address and use it instead of localhost ...

- 2,719
- 1
- 28
- 28
Check your Internet Connection on PC first, then Turn on Wifi in your Genymotion Emulator Device
After goto Cmd by Pressing ctrl+r then type Cmd and hit enter you will see an command line window
type ipconfig and hit enter...
here you can see your ipv4 address type it in your Genymotion Emulator Device's Browser now you can connect to your local webserver....

- 281
- 2
- 7
In my case 10.0.3.2 didn't work. I changed to virtual box host-only network : 192.168.128.2 it works. You have to try other virtualbox adapters IP if it doesn't work with 192.168.56.1. My environment is behind a corporate proxy and I was running an embedded undertow server. Hope it helps.

- 591
- 1
- 7
- 16