Xamarin Android Emulator Mac

-->

Important

This article describes functionality and guidance that is in public preview and may be substantially modified before it's generally available. Microsoft makes no warranties, express or implied, with respect to the information provided here.

To build Android apps with Xamarin in C# using Visual Studio, set up these tools then follow the instructions on this page:

  • Get the latest version of Visual Studio and ensure Xamarin is installed.
  • Ensure the Android SDK is installed via these Visual Studio instructions.
  • Review the hardware acceleration guide to get the best emulator performance.

Jun 22, 2018 In this article. The topics in this section explain how to install and configure Xamarin.Android to work with Visual Studio on Windows and macOS, how to use the Android SDK Manager to download and install Android SDK tools and components that are required for building and testing your app, how to configure the Android emulator for debugging, and how to connect a physical Android device to your. The interesting part here is how you should run and connect to iOS and Android emulators. With iOS emulators everything is straightforward to configure. As Pair to Mac for Xamarin.iOS development documentation says the setup can be accomplished with the following steps: Enable remote login on your Mac. If the emulator is not already running, you can start it from the command line (rather than from within Visual Studio for Mac) to view its output. Typically, Android emulator AVD images are stored at the following location: /.android/avd. You can launch the emulator with an AVD image from this location by passing in the folder name of the AVD.

Install the emulator preview

  1. Jul 12, 2021 Free Android Emulator For Mac; Xamarin Android Emulator Amd; As of Android SDK Tools version 26.0.1 and later, Google has removed support for existing AVD/SDK managers in favor of their new CLI (Command Line Interface) tools.
  2. User326158 posted. Hello, On Mac OS X, I've used the Xamarin Android SDK Manager to download, via the Platforms tab, these things: Android 8.0 'Android SDK Platform', 'Google APIs Intel x86 Atom System Image', Google Play Intel x86 Atom System Image'.

Get the installer from the Microsoft Download Center:

Choose the .zip package for Windows or the .dmg for macOS.

When the download has completed, run the installer.

The installer places icons in the Start menu, inside a SurfaceDuoEmulator folder. Use the icon labelled Surface Duo Emulator for Visual Studio to open the emulator before attempting to deploy inside Visual Studio.

After the download has completed:

  1. Open the SurfaceDuoEmulator_ version _.dmg file.
  2. Copy the contents of the emulator folder to your local hard drive. (The emulator folder name cannot have periods in it.)

The emulator folder contains a number of shell scripts that can start the emulator. Visual Studio for Mac users should start the scripts with the _vs suffix (eg. run_vs.bat and run_vs_clean.bat).

Run the emulator

Visual Studio will not automatically start the Surface Duo emulator, so you should manually open it before attempting to deploy or debug your Xamarin app.

Follow these instructions to start the emulator, after which it will appear as a deployment option in Visual Studio:

After completing the SDK Setup, you can launch the Surface Duo Emulator for Visual Studio via the Start menu link.

In the installation folder, there is a batch file run_vs.bat which you can execute directly. There is also a run_vs_clean.bat file which will start the emulator in a fresh state (rather than continue a previous session).

Xamarin Android Emulator Mac Os

If the emulator does not start, you might need to update the pointer to your Android SDK installation.

  • In a terminal window, navigate to the folder where you copied the emulator
  • Type ./run_vs.sh to start the emulator.
Emulator

There is also a run_vs_clean.sh script that will start the emulator in a fresh state rather than continuing a previous session.

Note

The installation folder contains start-up scripts named run and run_vs. The run scripts are intended for developers using Android Studio and the run_vs scripts are for Visual Studio users. The differences are the Android SDK location and the port used for the emulator.

If the emulator is running but does not appear as a deployment option in Visual Studio, close the emulator and re-start, confirming that you are using the script with vs in the name.

Xamarin Android Emulator Troubleshooting

Debugging your Xamarin Android App

Open your Project in Visual Studio, build it, and select <build> (Android 10.0 - API 29) (in the list of Running Devices) and deploy.

Debugging (breakpoints, step into, step over, etc) will all work as usual.

Troubleshooting

Xamarin Android Emulator Mac Download

Xamarin

Surface Duo emulator does not appear in the Visual Studio device list

The current version of the Surface Duo emulator cannot be started by Visual Studio. First manually start the emulator and once it's running it should appear in the list for deployment and debugging:

  • Windows - open Start > Surface Duo Emulator and choose Surface Duo Emulator for Visual Studio.
  • Mac - start from the command line using sh ./run_vs.sh (the 'VS' in the script name indicates it is intended for Visual Studio for Mac).

Update the pointer to your Android SDK

If you changed the installation location of the Android SDK from the default, you will need to update the run_vs script to point to the correct installation location. Otherwise, the emulator will not run when you click the shortcut or run the script.

  1. Find the installation location of the Surface Duo Emulator. The default location is %USERPROFILE%SurfaceDuoEmulator.
  2. Open the artifacts folder inside of the installation folder.
  3. Make a backup copy of run_vs.bat - You can copy it to something like run_vs_original.bat.
  4. Open the file run_vs.bat in a text editor.
  5. Verify the ANDROID_SDK_LOCATION path value near the top of the file is correct.
  1. Find the location you extracted the downloaded Surface Duo Emulator archive to.
  2. Make a backup copy of run_vs.sh - You can copy it to something like run_vs_original_.sh.
  3. Open the file run_vs.sh in a text editor.
  4. Verify the ANDROID_SDK_LOCATION path value near the top of the file is correct.

When you are developing on an emulator, you may want to look at the files created by the application. Each emulator and SDK tools have different capabilities on reading and writing files to disk. You may want to do this to open a SQLite Database, or to change the hosts file in Windows Mobile Emulator.

Windows Mobile Emulator

Windows Mobile Emulator, I have found to be the most cumbersome. You must shutdown the emulator, and load the VDD separately to see what is stored locally.

Open up HyperV and ensure the image you want to open is stopped.

Next, go to the Settings for this Emulator, select the Hard Drive and copy the location of its Virtual Hard Disk.

Open Disk Management and select Action > Attach a VHD.

Copy the virtual hard disk’s location and press OK.

Locations

The hard drive will now be available for you to browse. The folder structure is very similar to a Windows installation.

Visual Studio Android Emulator

There are multiple ways to access vhd for Android. You can use the same method as above or you have two other options.

Install App

You can install a file explorer app on your Android device to browse through files. There are a lot to choose from, search File Explorer on Google Play Store on your emulator.

Android SDK Tools

Open the Android Device Monitor

From here you can select your emulator and open the files as needed in the File Explorer.

Locations

Xamarin Android Emulator Mac Free

iOS Simulator

Xamarin Android Emulator Mac Free

The iOS simulator runs on a Mac, even if you are building via Windows. IOS is much simplier to access than the others as it is just stored in a directory on the main disk drive.

First you will want to find your DeviceId. On your Mac, go to Hardware > Device > Manage Devices.

Then find your simulator and record the Device Identifier.

Now to get to your file location in iOS 8 and above, fill in the below. Regarding the ApplicationId, I normally look through a few folders until I find the right one.

Locations