Managing virtual devices with the Android Device Manager

This article explains how to use the Android Device Manager to create and configure Android Virtual Devices (AVDs) that emulate physical Android devices. You can use these virtual devices to run and test your app without having to rely on a physical device. For more information about Android virtual devices, see Create and manage virtual devices on developer.android.com.

Important

Enable hardware acceleration for the Android devices. For more information, see Hardware Acceleration for Emulator Performance.

Android Device Manager on Windows

You use the Android Device Manager to create and configure an Android Virtual Devices (AVD) that run in the Android Emulator. Each AVD is an emulator configuration that simulates a physical Android device. This makes it possible to run and test your app in a variety of configurations that simulate different physical Android devices.

Screenshot of the Android Device Manager in the Devices tab.

Requirements

To use the Android Device Manager, you'll need the following items:

  • Visual Studio 2022: Community, Professional, and Enterprise editions are supported.

  • The Android SDK API Level 30 or later. Be sure to install the Android SDK at its default location if it isn't already installed: C:\Program Files (x86)\Android\android-sdk.

  • The following packages must be installed:

    • Android SDK Tools 5.0 or later
    • Android SDK Platform-Tools 31.0.3 or later
    • Android SDK Build-Tools 30.0.2 or later
    • Android Emulator 30.8.4 or later

    These packages should be displayed with Installed status as seen in the following screenshot:

    Installing Android SDK Tools.

When you install the .NET Multi-Platform App UI development workload in Visual Studio, everything is installed for you. For more information on setting up .NET MAUI with Visual Studio, see Build your first app.

Open the device manager

Open the Android Device Manager in Visual Studio from the Tools menu by pressing Tools > Android > Android Device Manager:

Launching the Device manager from the Tools menu.

Main screen

When you run the Android Device Manager, it presents a screen that displays all currently configured virtual devices. For each virtual device, the Name, OS (Android Version), Processor, Memory size, and screen Resolution are displayed:

When you select a device in the list, the Start button appears on the right. Press the Start button to launch the emulator with this virtual device. If the emulator is running with the selected virtual device, the Start button changes to a Stop button that you can use to halt the emulator.

Create a new device

To create a new device, press the New button:

New button for creating a new device.

The New Device window is displayed. To configure the device, follow these steps:

  1. Give the device a new name. In the following example, the new device is named Pixel 3a - API 31.

    New Device screen of the Device Manager.

  2. Select a physical device to emulate by selecting a device in the Base Device box.

  3. Select a processor type for this virtual device with the Processor box.

    It's recommended that you choose x86_64 and enable hardware acceleration.

  4. Select the Android version (API level) with the OS box.

    If you select an Android API level that has not yet been installed, the Device Manager will display A new device will be downloaded message at the bottom of the screen – it will download and install the necessary files as it creates the new virtual device.

  5. If you want to include Google Play Services APIs in your virtual device, select the Google APIs option. To include the Google Play Store app on the virtual device, select the Google Play Store option

    Note

    Google Play Store images are available only for some base device types such as Pixel, Pixel 2, Pixel 3, and Nexus 5. This is indicated by the text (+ Store) in the image name.

  6. Use the property list to change some of the most commonly modified properties. To make changes to properties, see Editing Android Virtual Device Properties.

  7. Add any additional properties that you need to explicitly set with the Add Property box at the bottom of the window:

    Add Property pull-down menu.

    You can also define a custom property by selecting Custom....

  8. Press the Create button to create the new device:

    Create button.

    You might get a License Acceptance screen when you create the device. Select Accept if you agree to the license terms.

  9. The Android Device Manager adds the new device to the list of installed virtual devices while displaying a Creating progress indicator during device creation:

    Creation progress Indicator.

  10. When the creation process is complete, the new device is shown in the list of installed virtual devices with a Start button, ready to launch

Edit device

To edit an existing virtual device, select the device and then press the Edit button:

Edit button for modifying a device.

Pressing Edit displays the Device Editor window for the selected virtual device.

The Device Editor window lists the properties of the virtual device under the Property column, with the corresponding values of each property in the Value column. When you select a property, a detailed description of that property is displayed on the right.

To change a property, edit its value in the Value column. For example, in the following screenshot the hw.lcd.density property is being changed to 240:

Device Editing example.

After you've made the necessary configuration changes, press the Save button. For more information about changing virtual device properties, see Editing Android Virtual Device Properties.

Additional options

Additional options for working with devices are available from the Additional Options (…) pull-down menu:

Location of additional options menu.

The additional options menu contains the following items:

  • Duplicate and Edit – Duplicates the currently selected device and opens it in the New Device screen with a new name that's similar to the existing device. For example, selecting Pixel 3a - API 31 and pressing Duplicate and Edit appends a counter to the name: Pixel 3a - API 31 (1).

  • Start with Factory Defaults – Starts the device with a cold boot.

  • Start with Kernel Logs – Starts the emulator and opens up kernel logs directory.

  • Download System Image – Downloads the Android OS system image for the device, if it's not already downloaded.

  • Reveal in Explorer – Opens Windows Explorer and navigates to the folder that holds the files for the virtual device.

  • Repair – Initiates a repair on the device.

  • Factory Reset – Resets the selected device to its default settings, erasing any user changes made to the internal state of the device while it was running. This action also erases the current Fast Boot snapshot if it exists. This change doesn't alter modifications that you make to the virtual device during creation and editing. A dialog box will appear with the reminder that this reset cannot be undone – press Factory Reset to confirm the reset.

  • Delete – Permanently deletes the selected virtual device. A dialog box will appear with the reminder that deleting a device cannot be undone. Press Delete if you are certain that you want to delete the device.

Troubleshooting

The following sections explain how to diagnose and work around problems that may occur when using the Android Device Manager to configure virtual devices.

Wrong version of Android SDK Tools

If you have the wrong Android SDK tools installed, installed, you may see this error dialog on launch:

Screenshot shows the Android SDK instance error dialog box.

If you see that error dialog, press Open SDK Manager to open the Android SDK Manager. In the Android SDK Manager, go to the Tools tab and install the following packages:

  • Android SDK Command-line Tools 5.0 or later
  • Android SDK Platform-Tools 31.0.3 or later
  • Android SDK Build-Tools 30.0.3 or later

Snapshot disables Wi-Fi on Android Oreo

If you've an AVD configured for Android Oreo with simulated Wi-Fi access, restarting the AVD after a snapshot may cause Wi-Fi access to become disabled.

To work around this problem,

  1. Open the Android Device Manager.

  2. Select the AVD in the Android Device Manager.

  3. From the Additional Options (…) menu, select Reveal in Explorer.

  4. Navigate to the snapshots > default_boot folder.

  5. Delete the snapshot.pb file:

    Location of the snapshot.pb file.

  6. Restart the AVD.

After these changes are made, the AVD will restart in a state that allows Wi-Fi to work again.