Visual Studio emulator for Android not starting/deploying in VMWare Fusion on macOS Sierra

RussellFustinoRussellFustino USUniversity ✭✭

Has anyone got the VS emulator for Android working in any VM?

I've installed VS2017 15.7 on a VMware Fusion (latest version) running Windows 10 (latest version, latest updates) with virtual Hyper-V enabled.

I create a brand new project using the Xamarin Forms template.

I try to run it on any of the Visual Studio Android emulators and none seem to work.

The emulator starts up and seems functional.

However, Visual Studio just hangs and never seems to actually install the app onto the emulator. After a while if I click on the emulator to view the apps, i get a black screen in the emulator.

I can stop the build / deployment and Visual Studio is responsive.
Here is a similar post as to what is happening to me…
https://forums.xamarin.com/discussion/83756/visual-studio-android-emulator-black-screen-in-apps-periodically

The resolution in that post was to remove a line in the xdesku.xml file
https://creativewebspecialist.co.uk/2015/07/22/how-to-use-visual-studio-android-emulator-on-vmware-fusion/
(In Windows, you’ll need to edit the c:\program files (x86)\Microsoft XDE\10.0.10240.0\skus\android\xdesku.xml file and remove the following line from the file: GuestDisplayProvider=”VsEmulator.OpenGLGuestDisplay”)

I tried this, but still no luck.

I bumped the vm up to 10 gig and 4 processors, still no luck.

I have unchecked fast deployment in the visual studio iDE for Android properties. Also, in hyper-v I have selected processor compatibility and migrate to physical computer as well as 2 virtual processors for the emulators. These are usually the things that impact Android emulators from working correctly on the metal.

I am stumped. I am running the Visual Studio Emulator for Android. I even disabled 3D graphics as well as high res retina in the VM . I am getting runtime checks failed in deploying to the emulator.

The same test works fine on my Windows 10 desktop.

I can deploy to a physical device in the VM. And this is a hello world Xamarin Forms application. I just tried this with Parallels too, and have the same result. Also, while the VS for Android emulator is running, and I query the attached devices using "adb devices" in the ADB Command prompt, I get back an empty list in the VM. On the metal I get back an IP address of the emulator. Another clue I hope?

Best Answer

  • RussellFustinoRussellFustino US ✭✭
    Accepted Answer

    Looks like this is the supported solution from Microsoft:

    https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/questions/connect-android-emulator-mac-windows

    It actually uses the emulator running on the Mac side accessed from the VM on the windows side, which is the environment I need. I can set break points and debug when needed from Windows and have the same dev environment for iOS, Android and Windows. Also, Android apps will deploy to a connected device as well if I need that, as well as this link to get it to work on Xamarin Android Player https://montemagno.com/debug-with-the-xamarin-android-player-from-visual/ . So, it looks like I am all set on this for now.

    Recap:
    Start the emulator on the Mac. (I use Mac VS to start this)

    On the mac , from VS for the Mac, open the command Tools | SDK Command Prompt
    Run these commands

    adb kill-server
    lsof -iTCP -sTCP:LISTEN -P | grep 'emulator|qemu'
    (this will get the ip address of the mac)

    cd /tmp
    mkfifo backpipe
    nc -kl 5555 0 backpipe
    (as long as this window is open , you can connect to it on the VM side)

    Then on the VM Machine, from Visual Studio open Tools | Android | ABD Command Prompt

    adb connect ip-address-of-the-mac:5555

    You will then see an Unknown vm emulator in the drop down in VS to deploy the app to. It will appear on the mac side.

Answers

  • RussellFustinoRussellFustino USUniversity ✭✭
    Accepted Answer

    Looks like this is the supported solution from Microsoft:

    https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/questions/connect-android-emulator-mac-windows

    It actually uses the emulator running on the Mac side accessed from the VM on the windows side, which is the environment I need. I can set break points and debug when needed from Windows and have the same dev environment for iOS, Android and Windows. Also, Android apps will deploy to a connected device as well if I need that, as well as this link to get it to work on Xamarin Android Player https://montemagno.com/debug-with-the-xamarin-android-player-from-visual/ . So, it looks like I am all set on this for now.

    Recap:
    Start the emulator on the Mac. (I use Mac VS to start this)

    On the mac , from VS for the Mac, open the command Tools | SDK Command Prompt
    Run these commands

    adb kill-server
    lsof -iTCP -sTCP:LISTEN -P | grep 'emulator|qemu'
    (this will get the ip address of the mac)

    cd /tmp
    mkfifo backpipe
    nc -kl 5555 0 backpipe
    (as long as this window is open , you can connect to it on the VM side)

    Then on the VM Machine, from Visual Studio open Tools | Android | ABD Command Prompt

    adb connect ip-address-of-the-mac:5555

    You will then see an Unknown vm emulator in the drop down in VS to deploy the app to. It will appear on the mac side.

  • NMackayNMackay GBInsider, University mod
    edited May 2018

    Try the Mac forum, you'll get more help there.

    https://forums.xamarin.com/categories/mac

    This forum is for Forms issues, discussion.

Sign In or Register to comment.