Note
The following methods only applies if Genymotion Desktop and your server/service run on the same host machine.
If the application you are developing needs to connect to a local server or service, such as a REST service, you may need your virtual device to access your local host.
With VirtualBox
To do this, you can use the IP address 10.0.3.2
from the virtual device to reach your service or server. IP 10.0.3.2
is a VirtualBox alias to your host loopback interface (i.e., 127.0.0.1 on your host machine).
For example, if you run a service on your host machine which listens to localhost:1234
, it can be accessed from the virtual device using the IP 10.0.3.2:1234
.
With QEMU
Unlike VirtualBox, there is no loopback interface when using QEMU. However, it is possible to use adb reverse
to bind a virtual device local port to a host local port.
For example, if you run a service on your host machine that listens to localhost:1234
, then use the command:
adb reverse tcp:1234 tcp:1234
This will bind the virtual device local TCP port 1234 to your host machine local TCP port 1234. Thus, the service can be accessed from the virtual device using the IP localhost:1234