Connect to genymotion in OS X from VS running in Parallels?

PaulBatumPaulBatum Paul BatumUSMember

I have the following configuration:

  • Genymotion installed in OS X
  • Parallels with Visual Studio + Xamarin

I followed this guide and managed to get it so that I can F5 from VS into a standard emulator, but now I'm trying to get the same thing working with genymotion and I'm stuck. When I run 'adb devices' in Windows, it won't list the genymotion emulator. I think the issue is that the genymotion emulator runs on its own IP address, and I can't figure out how to get the SSH tunneling to point at that address. I also tried to skip the SSH trick and just tell ADB to connect to 192.168.56.101:5555 (genymotion emulator IP) but my Windows VM can't see that IP address (maybe its related to my virtual network adapter settings?).

Has anyone figure out how to make this work?

Posts

  • PaulBatumPaulBatum Paul Batum USMember

    I figured it out. You need another SSH tunnel from the host to the genymotion emulator. It turned out this was pretty simple. From OS X run:

    ssh -L 5555:192.168.56.101:5555 -N 127.0.0.1

    where 192.168.56.101 is the IP of your genymotion emulator

    Next in Windows kill adb using 'adb kill-server' and then start it again using 'adb connect localhost'. Then if you run 'adb devices' you should see localhost:5555 in the list. Now run VS (restart it if its already running), it should connect to the new adb instance and you should see your genymotion emulator in the dropdown.

    I now get to enjoy the benefits of a super fast Android emulator + VS + Xamarin on my macbook :)

  • chris_riesgochris_riesgo Chris Riesgo USUniversity ✭✭✭

    @PaulBaturn - When I start GenyMotion in OS X, Parallels Desktop crashes claiming incompatible virtualization with VirtualBox. How did you get around this?

  • PaulBatumPaulBatum Paul Batum USMember

    Ah, I forgot about this step. I got the relevant info from this thread:
    https://groups.google.com/forum/#!topic/genymotion-users/bkJQ7bxOxTw

    Specifically, I went into virtualbox and disabled vt-x under settings->system->acceleration.

  • SpencerjungSpencerjung Spencer jung USMember, University

    Paul,

    I have GenyMotion running on my PC.. I executed your commands - adb devices and see List of devices attached
    192.168.56.101:5555 device

    How do I get VS to recognize this in VS?? I looked under tools and other menus...

  • PaulBatumPaulBatum Paul Batum USMember

    Just to make sure that the rest of your setup is working, were you able to get VS to recognize a standard (non-genymotion) emulator running on your mac as explained in the linked article above? If that is working then the extra SSH tunnel is all you should really need for it to see the genymotion emulator. I did notice that I had to restart VS after establishing the ADB connection.

  • KrumelurKrumelur René Ruppert DEUniversity ✭✭

    Thank you so much for this post! Finally I can run Genymotion and Parallels! On my iMac core i7 it is no problem to run Genymotion without hardware acceleration.

    One important note still: if you disable "VT-X" and your Android device has more than one CPU, the setting will be turned on again silently! Be sure to set the CPU cores to 1 before changing the setting!

  • KrumelurKrumelur René Ruppert DEUniversity ✭✭

    @PaulBatum I got Genymotion running together with Parallels. However I fail to connect to the Emulator from VS. If I check the Wifi setting in the Android Image, its IP is 10.0.3.15 which is a totally different range than my other machines have (192.*).
    On Mac OS I tried ssh -L 5555:10.0.3.15:5555 -N 127.0.0.1 and it asks me for my password. If I enter it, nothing happens. Is that normal? The terminal window is basically blocked until I press CTRL+C.

    On Windows if I follow your instructions I get:

    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    unable to connect to localhost:5555
    

    Any ideas?

  • KrumelurKrumelur René Ruppert DEUniversity ✭✭

    I figured out an alternative solution: switch Paralells Desktop network connection to "Shared". Then, use the IP that is shown in the toolbar of the running Genymotion device (192.168.56.101 in my case).
    On Windows you can then directly connect to it without using SSH:

    adb connect 192.168.56.101

  • KrumelurKrumelur René Ruppert DEUniversity ✭✭
  • GazpGazp Gareth Pym USMember, Beta

    Hi

    Following the previous details in this thread I'm able to successfully connect to an API 16 Genymotion emu (running on my MAC host) from Visual Studio running in a WMWare Fusion guest. I can deploy in VS to the emu fine. However, if I try the same with an API 19 emu the 'adb connect IP' command appears to work but the emu always shows as offline with 'adb devices'?

    As of Android v4.2.2 there is a security dialog that needs to be OK'd on the device to enable debugging it seems but this never gets displayed on the emu when I connect

    Has anybody else managed to get API19 v4.2.2 and above GenyMotion emus to work?

  • PkL728PkL728 Patrick Lind USMember

    Gazp this looks like it is just an incompatibility with Xamarin and API 19 in general:

    http://stackoverflow.com/questions/22672355/application-fails-to-deploy-to-android-intel-emulator-on-api-19-platform-4-4-2

  • saramgsilvasaramgsilva Sara Silva PTInsider, University, Developer Group Leader ✭✭

    @Krumelur I tried to follow your article, but I wasn´t sucess :/

    This
    ssh -f -L 5555:192.168.56.101:5555 -N 127.0.0.1
    fails and this

        adb kill-server
    

    fails too.

    Any tip for it?

  • MarkRileyMarkRiley Mark Riley GBMember ✭✭
    edited September 2015

    @Gazp I know this is an old thread, but did you ever manage to find a solution to your 'offline' emulators?

    I am experiencing the same problem and am struggling to find a solution.

  • GazpGazp Gareth Pym USMember, Beta

    @MarkRiley I now use the Xamarin Android Player (instead of the GenyMotion emus) directly on my Mac with XS with no adb connectivity issues as opposed to using VS in a VM so I'm afraid I can't suggest much. Do you get the same behaviour with the Xamarin Android Player emus?

  • MarkRileyMarkRiley Mark Riley GBMember ✭✭

    Thanks @Gazp. I only just found out about the Xamarin Android Player. I have now tried it and it seems to solve the 'offline' problem when connecting via a VM.

  • hvaughanhvaughan hines vaughan USMember ✭✭✭
    edited December 2016

    Or you could just open Xamarin Studio on your Mac and point it to your Windows VM solution file... but who wants to make things easy for themselves!

  • DimitarDobrev.0834DimitarDobrev.0834 Dimitar Dobrev USMember ✭✭
    edited March 24

    Fellows, there's a solution for the problem of Genymotion simulators appearing off-line in ADB after completing all steps (https://forums.xamarin.com/discussion/comment/51209/#Comment_51209). You can find detailed instructions at https://ihamlin.co.uk/2017/01/25/genymotion-adb-connect-device-offline.html . I have added the basics here in case the link dies in the future:

    1. Close all existing Genymotion devices
    2. Kill any existing adb processes on the Mac
    3. Update the Genymotion settings to set a custom SDK path, but leave the path empty.
    4. Relaunch the Genymotion device
    5. When asked if you wish to use the default SDK select No
  • hvaughanhvaughan hines vaughan USMember ✭✭✭

    @DimitarDobrev.0834 Thank you!!! Very cool, works great.

Sign In or Register to comment.