Even if this might appear as an edge case I know a lot of Android devs using Genymotion emulator for Mac in their daily work, but emulators in general, are RAM eater that slow down the entire system.

Genymotion is an awesome Android emulator, the support is good and the installation is fast and simple: it simply works out of the box!

After experimenting some configurations, I’ve accomplished to run Genymotion on a Windows PC and make it available for connection from my Mac.

The solution has been tested on a local trusted network nevertheless, an SSH tunnel would be preferable.

This solution can be convenient if you don’t want to overload your Mac with the heaviness of the emulator or/and a long test suite takes some time to finish and in the meantime you need to switch to another emulator.

 

Precondition:

  • Mac with Android SDK.
  • Windows with Genymotion installed.

First of all,  go to Genymotion settings > ADB > Select Use custom Android SDK tool and leave it empty, in this way Genymotion will not restart the local ADB when the external ADB will try to connect.

Set Genymotion SDK empty

Now you need to open port 5555 and 5554 to let ADB connects to Genymotion.

On Start, go to Windows System > Control Panel > System and Security > Windows Firewall > Advanced Settings.

ADB remote 5555

Right click on Inbound Rules > New Rule

Select Port

img_20161002_181101

Select TCP

In Specific local ports type 5555

img_20161002_181123

Select Allow the connection

img_20161002_181133

Uncheck Domain and Public if you need this rule for your home network only

img_20161002_181143

Add a name to the rule I’ve called it ADB remote 5555

img_20161002_181236

Now right click on Inbound Rules > New Rule once again and repeat the process for port 5554.

Use the same configurations, just specify 5554 in Specific local ports, and in the end call the rule ADB remote 5554

It’s time to start Genymotion and run our Android emulator.

Take note of the IP address of the emulator, from now on I’ll call it .

emulatorip

And now it’s time to forward the incoming connections to the Genymotion emulator.

From the windows machine run command line as administrator: go to Start > type cmd > the first result will be Command Prompt right-click on it and select Run as administrator.

type

netsh interface portproxy add v4tov4 listenport=5555 connectport=5555 connectaddress=<emulatorIP>

and hit return.

type

netsh interface portproxy add v4tov4 listenport=5554 connectport=5554 connectaddress=<emulatorIP>

and hit return.

You can double check you typed correctly running this command

netsh interface portproxy show all

and you should see something like this

screenshot-2016-10-02-18-38-30

Now kill adb on Win

adb kill-server

And take note of the local IP typing

ipconfig | findstr IPv4

I’ll call it .

screenshot-2016-10-02-18-48-32

Go finally to your Mac and restart the adb.

adb kill-server
adb start-server

And connect to Genymotion by typing the IP of the Windows PC

adb connect <windowsIP>:5555

screenshot-2016-10-02-18-51-05

 

 

This is the solution I found without using any external software for SSH tunnel or PuTTy, if you want to explore more solutions you can check these posts on StackOverflow