Condividi tramite


Download and install the Surface Duo Android emulator

The Surface Duo emulator image (to use with the Android Emulator) can be used to develop and test your apps with different screen sizes for both Surface Duo and Surface Duo 2.

Set up the Surface Duo development environment

You should have your Android development environment set-up and up to date before you install the Surface Duo SDK. If you don't have Android Studio installed, download the latest version and command line tools from developer.android.com. You must include Google's Android emulator, which you install using the SDK manager in the Android Studio Tools menu. For new installs, the default options will do this automatically.

Surface Duo emulator prerequisites

  • To get the full functionality of Surface Duo emulator, please install Android Emulator version 31.3.12 or newer (or if you use the canary channel, version 32.1.5 or newer).

  • Use the SDK manager to ensure all the required dev tools (Android SDK Build-Tools, Android SDK Platform-Tools, and Android Emulator) are up to date.

    SDK Manager

Environment variables update

If you changed the install location of the Android SDK from the default, you need to update the environment variables based on how your Android SDK tools is set, especially ANDROID_SDK_ROOT, if you use Android Studio.

Hardware acceleration

Hardware virtualization is available for the Surface Duo emulator. Follow the guidelines outlined in emulator acceleration in the Android Studio docs to configure your system.

Microsoft Visual Studio for Xamarin and .NET MAUI

Visual Studio installs its own version of the Android SDK and emulator. Follow these steps to set up your development environment, and use Visual Studio to manage your Android SDK settings:

  1. Get the latest version of Visual Studio and ensure the Xamarin or .NET MAUI workloads are installed.
  2. Ensure the Android SDK is installed via these Visual Studio instructions.
  3. Review the hardware acceleration guide to get the best emulator performance.

Note

Visual Studio's Android SDK management defaults to specific, tested versions of the Android SDK and tools. This may block you from updating to the newest version of the Android Emulator or other tools as soon as they become available. Read the Xamarin-specific emulator guide for details on how to update to the latest version.

Ubuntu/Debian

  • Complete the installation prerequisites.
  • The KVM software package is required. Complete the steps at Configure VM acceleration on Linux to install KVM.
    • After installing KVM, ensure the current (logged in) user is added to the KVM group.

      $ groups
      <current user> sudo plugdev kvm libvirt
      
    • If the current user is not in the KVM group, run the following command to add them:

      sudo usermod -a -G kvm <current user>
      
    • Reboot the machine.

Apple Mac

The Android Studio installation instructions with default settings are all that is required. Be sure to perform updates to the latest SDK if you already have Android Studio installed.

There are two separate Surface Duo Emulator installers for Mac - one for older Intel-based Macs and a separate installer for newer Apple Silicon-based Macs with M1 or M2. Make sure to choose the correct installer for your computer - older Macs should use the installer with x86_64 in the filename, Apple Silicon Macs should use the installer with arm64 in the filename.

Download and install the Surface Duo emulator image

Download the Surface Duo emulator image from the Microsoft Download Center. The files are named SurfaceDuoEmulator_[Android API]_[version]_[platform]. There are Android 10, Android 11, and Android 12L Surface Duo emulator variants. Select a combination of API level and platform from the Download Center options reproduced in the image below (highlighting the new Apple Silicon support for macOS):

Emulator download operating system and architecture options, including Android 10, 11, and 12L across Windows, macOS, and Linux

Download Surface Duo emulator on the Microsoft Download Center.

Return to this page when you have downloaded the file.

Install and run the SDK and emulator

Important

Do not install the new AVD version (beyond March 2022) in the existing directory of the old version on the emulator (prior to March 2022), or overwrite between different Android versions, like the Android 11 emulator over the Android 10 version.

Tip

The run.bat and run.sh scripts should never be executed directly. They are indirectly called from the other device specific scripts. Use run_SurfaceDuo/run_SurfaceDuo2.bat and run_SurfaceDuo/run_SurfaceDuo2.sh instead.

  1. Launch the SurfaceDuoEmulator_[version]_windows.exe installer and follow the Setup Wizard to install the emulator.
  2. After completing the SDK Setup, you will find two new app icons in the desktop and the Start menu. You can launch the Surface Duo Emulator or Surface Duo 2 Emulator via the app icons or the Start menu links.
  3. If you changed the install location of the Android SDK from the default, don't forget to update your environment variables or update the pointer to your Android SDK.

Update the pointer to your Android SDK

Important

If you never change the installation location of the Android SDK or you've updated your environment variables, you can now skip to Get started with the Surface Duo emulator.

If you installed the Android Studio SDK to a non-default location, you will need to either update the relevant environment variables, or update the run script to point to the correct install 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. You can right-click the app icon in the desktop to Open file location.

  2. Open the file run.bat in a text editor.

  3. Verify the DEFAULT_ANDROID_SDK_LOCATION_WIN or DEFAULT_ANDROID_SDK_LOCATION_WIN_VS if you use Visual Studio inside the script file, the following path value matches the installation location of your Android SDK.

    rem ##### ENSURE THE ANDROID SDK LOCATION BELOW IS CORRECT ####### 
    set "DEFAULT_ANDROID_SDK_LOCATION_WIN=%LOCALAPPDATA%\Android\Sdk" 
    set "DEFAULT_ANDROID_SDK_LOCATION_WIN_VS=C:\Program Files (x86)\Android\android-sdk" 
    

Next steps

Read how to get started with the Surface Duo emulator, then start building and testing apps with your preferred development tools: