Android emulator troubleshooting

This article describes the most common warning messages and issues that occur while configuring and running the Android Emulator. In improver, it describes solutions for resolving these errors as well equally various troubleshooting tips to help you lot diagnose emulator bug.

Deployment issues on Windows

Some error messages may be displayed by the emulator when you deploy your app. The near common errors and solutions are explained hither.

Deployment errors

If you run across an error nearly a failure to install the APK on the emulator or a failure to run the Android Debug Span (adb), verify that the Android SDK can connect to your emulator. To verify emulator connectivity, use the following steps:

  1. Launch the emulator from the Android Device Manager (select your virtual device and click Commencement).

  2. Open up a control prompt and become to the folder where adb is installed. If the Android SDK is installed at its default location, adb is located at C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe; if not, modify this path for the location of the Android SDK on your computer.

  3. Type the following command:

                        adb devices                                      
  4. If the emulator is accessible from the Android SDK, the emulator should appear in the list of attached devices. For instance:

                        Listing of devices attached emulator-5554   device                                      
  5. If the emulator does not appear in this listing, starting time the Android SDK Manager, utilise all updates, then try launching the emulator again.

MMIO access error

If the bulletin An MMIO access error has occurred is displayed, restart the emulator.

Missing Google Play Services

If the virtual device you lot are running in the emulator does not have Google Play Services or Google Play Shop installed, this condition is oftentimes caused by creating a virtual device without including these packages. When you lot create a virtual device (meet Managing Virtual Devices with the Android Device Manager), be sure to select one or both of the following options:

  • Google APIs – includes Google Play Services in the virtual device.
  • Google Play Store – includes Google Play Store in the virtual device.

For example, this virtual device will include Google Play Services and Google Play Shop:

Example AVD with Google Play Services and Google Play Store enabled

Note

Google Play Store images are available only for some base of operations device types such as Pixel, Pixel 2, Nexus v, and Nexus 5X.

Performance issues

Functioning issues are typically caused by one of the following problems:

  • The emulator is running without hardware acceleration.

  • The virtual device running in the emulator is not using an x86-based system image.

The following sections encompass these scenarios in more detail.

Hardware dispatch is not enabled

If hardware acceleration is not enabled, starting a virtual device from the Device Managing director will produce a dialog with an error message indicating that the Windows Hypervisor Platform (WHPX) is non configured properly:

Example Device Manager warning

If this fault bulletin is displayed, run across Hardware acceleration issues beneath for steps you can accept to verify and enable hardware dispatch.

Acceleration is enabled but the emulator runs too slowly

A common cause for this problem is not using an x86-based image in your virtual device (AVD). When you create a virtual device (see Managing Virtual Devices with the Android Device Manager), be certain to select an x86-based system epitome:

Selecting an x86 system image for a virtual device

Hardware acceleration issues

Whether you lot are using Hyper-5 or HAXM for hardware dispatch, you may see configuration problems or conflicts with other software on your estimator. You tin can verify that hardware acceleration is enabled (and which acceleration method the emulator is using) by opening a control prompt and inbound the following command:

                "C:\Plan Files (x86)\Android\android-sdk\emulator\emulator-check.exe" accel                              

This command assumes that the Android SDK is installed at the default location of C:\Plan Files (x86)\Android\android-sdk; if non, change the above path for the location of the Android SDK on your computer.

Hardware dispatch not available

If Hyper-V is bachelor, a message like the post-obit example will be returned from the emulator-check.exe accel command:

                HAXM is not installed, but Windows Hypervisor Platform is available.                              

If HAXM is bachelor, a bulletin like the following example volition be returned:

                HAXM version half dozen.2.1 (4) is installed and usable.                              

If hardware acceleration is not available, a message like the post-obit example will exist displayed (the emulator looks for HAXM if information technology is unable to find Hyper-5):

                HAXM is non installed on this machine                              

If hardware dispatch is non bachelor, see Accelerating with Hyper-V to larn how to enable hardware acceleration on your computer.

Incorrect BIOS settings

If the BIOS has not been configured properly to back up hardware acceleration, a message like to the following example will be displayed when you run the emulator-cheque.exe accel command:

                VT feature disabled in BIOS/UEFI                              

To correct this problem, reboot into your calculator'south BIOS and enable the following options:

  • Virtualization Technology (may have a different label depending on motherboard manufacturer).
  • Hardware Enforced Data Execution Prevention.

If hardware dispatch is enabled and the BIOS is configured properly, the emulator should run successfully with hardware acceleration. Yet, bug may even so result due to issues that are specific to Hyper-V and HAXM, as explained adjacent.

Hyper-V issues

In some cases, enabling both Hyper-V and Windows Hypervisor Platform in the Plow Windows features on or off dialog may non properly enable Hyper-V. To verify that Hyper-V is enabled, utilise the following steps:

  1. Enter powershell in the Windows search box.

  2. Right-click Windows PowerShell in the search results and select Run as administrator.

  3. In the PowerShell console, enter the post-obit control:

                        Go-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online                                      

    If Hyper-V is not enabled, a message like to the following instance will be displayed to point that the state of Hyper-5 is Disabled:

                        FeatureName      : Microsoft-Hyper-V-All DisplayName      : Hyper-V Description      : Provides services and management tools for creating and running virtual machines and their resource. RestartRequired  : Possible State            : Disabled CustomProperties :                                      
  4. In the PowerShell console, enter the post-obit control:

                        Get-WindowsOptionalFeature -FeatureName HypervisorPlatform -Online                                      

    If the Hypervisor is not enabled, a message similar to the post-obit case will exist displayed to betoken that the state of HypervisorPlatform is Disabled:

                        FeatureName      : HypervisorPlatform DisplayName      : Windows Hypervisor Platform Description      : Enables virtualization software to run on the Windows hypervisor RestartRequired  : Possible State            : Disabled CustomProperties :                                      

If Hyper-V and/or HypervisorPlatform are not enabled, utilise the post-obit PowerShell commands to enable them:

                Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform -All                              

After these commands complete, reboot.

For more information about enabling Hyper-V (including techniques for enabling Hyper-V using the Deployment Image Servicing and Management tool), run into Install Hyper-V.

HAXM issues

HAXM issues are often the effect of conflicts with other virtualization technologies, incorrect settings, or an out-of-date HAXM driver.

HAXM process is not running

If HAXM is installed, you tin verify that the HAXM process is running by opening a command prompt and inbound the post-obit command:

                sc query intelhaxm                              

If the HAXM process is running, yous should see output similar to the following result:

                SERVICE_NAME: intelhaxm     TYPE               : 1  KERNEL_DRIVER     Country              : 4  RUNNING                             (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)     WIN32_EXIT_CODE    : 0  (0x0)     SERVICE_EXIT_CODE  : 0  (0x0)     CHECKPOINT         : 0x0     WAIT_HINT          : 0x0                              

If STATE is not gear up to RUNNING, see How to Use the Intel Hardware Accelerated Execution Manager to resolve the problem.

HAXM virtualization conflicts

HAXM can conflict with other technologies that use virtualization, such as Hyper-V, Windows Device Baby-sit, and some antivirus software:

  • Hyper-V – If you are using a version of Windows before the Windows ten April 2022 update (build 1803) and Hyper-V is enabled, follow the steps in Disabling Hyper-5 and then that HAXM tin can be enabled.

  • Device Baby-sit – Device Guard and Credential Guard tin forestall Hyper-V from being disabled on Windows machines. To disable Device Guard and Credential Baby-sit, see Disabling Device Guard.

  • Antivirus Software – If you are running antivirus software that uses hardware-assisted virtualization (such as Avast), disable or uninstall this software, reboot, and retry the Android emulator.

Incorrect BIOS settings

If yous are using HAXM on a Windows PC, HAXM will non piece of work unless virtualization engineering science (Intel VT-10) is enabled in the BIOS. If VT-x is disabled, you will get an error similar to the following when you attempt to start the Android Emulator:

This reckoner meets the requirements for HAXM, simply Intel Virtualization Applied science (VT-x) is not turned on.

To correct this error, boot the computer into the BIOS, enable both VT-x and SLAT (Second-Level Address Translation), and so restart the computer dorsum into Windows.

Disabling Hyper-5

If you are using a version of Windows earlier the Windows 10 April 2022 Update (build 1803) and Hyper-Five is enabled, you must disable Hyper-V and reboot your calculator to install and use HAXM. If yous are using Windows 10 Apr 2022 Update (build 1803) or later, Android Emulator version 27.two.7 or afterward tin use Hyper-V (instead of HAXM) for hardware acceleration, then it is non necessary to disable Hyper-Five.

You can disable Hyper-V from the Command Console by following these steps:

  1. Enter windows features in the Windows search box and select Turn Windows features on or off in the search results.

  2. Uncheck Hyper-Five:

    Disabling Hyper-V in the Windows Features dialog

  3. Restart the estimator.

Alternately, yous can utilize the following PowerShell command to disable the Hyper-V Hypervisor:

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor

Intel HAXM and Microsoft Hyper-V cannot both exist active at the same fourth dimension. Unfortunately, at that place is no manner to switch betwixt Hyper-V and HAXM without restarting your calculator.

In some cases, using the higher up steps will non succeed in disabling Hyper-V if Device Guard and Credential Guard are enabled. If you are unable to disable Hyper-V (or information technology seems to be disabled but HAXM installation still fails), utilise the steps in the next section to disable Device Guard and Credential Baby-sit.

Disabling Device Baby-sit

Device Guard and Credential Guard can preclude Hyper-V from being disabled on Windows machines. This situation is often a problem for domain-joined machines that are configured and controlled by an owning organisation. On Windows x, use the following steps to come across if Device Baby-sit is running:

  1. Enter System info in the Windows search box and select System Information in the search results.

  2. In the System Summary, look to see if Device Guard Virtualization based security is nowadays and is in the Running state:

    Device Guard is present and running

If Device Guard is enabled, employ the following steps to disable it:

  1. Ensure that Hyper-Five is disabled (under Turn Windows Features on or off) as described in the previous section.

  2. In the Windows Search Box, enter gpedit.msc and select the Edit grouping policy search result. These steps launch the Local Group Policy Editor.

  3. In the Local Grouping Policy Editor, navigate to Estimator Configuration > Authoritative Templates > System > Device Guard:

    Device Guard in Local Group Policy Editor

  4. Change Plow On Virtualization Based Security to Disabled (as shown in a higher place) and go out the Local Group Policy Editor.

  5. In the Windows Search Box, enter cmd. When Command Prompt appears in the search results, correct-click Command Prompt and select Run as Administrator.

  6. Copy and paste the following commands into the command prompt window (if drive Z: is in utilize, option an unused bulldoze letter of the alphabet to use instead):

                        mountvol Z: /s copy %WINDIR%\System32\SecConfig.efi Z:\EFI\Microsoft\Boot\SecConfig.efi /Y bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader bcdedit /gear up {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi" bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215} bcdedit /gear up {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO,DISABLE-VBS bcdedit /set up {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=Z: mountvol Z: /d                                      
  7. Restart your computer. On the boot screen, you should see a prompt similar to the following bulletin:

    Do yous want to disable Credential Guard?

    Press the indicated key to disable Credential Guard every bit prompted.

  8. After the computer reboots, check once more to ensure that Hyper-V is disabled (every bit described in the previous steps).

If Hyper-V is still non disabled, the policies of your domain-joined calculator may prevent you from disabling Device Guard or Credential Guard. In this case, you lot can request an exemption from your domain administrator to allow yous to opt out of Credential Guard. Alternately, you can use a computer that is non domain-joined if you must apply HAXM.

Boosted troubleshooting tips

The post-obit suggestions are often helpful in diagnosing Android emulator issues.

Starting the emulator from the command line

If the emulator is not already running, you can start it from the control line (rather than from within Visual Studio) to view its output. Typically, Android emulator AVD images are stored at the following location (supercede username with your Windows user name):

C:\Users\username\.android\avd

You can launch the emulator with an AVD prototype from this location by passing in the binder name of the AVD. For example, this command launches an AVD named Pixel_API_27:

                "C:\Program Files (x86)\Android\android-sdk\emulator\emulator.exe" -partition-size 512 -no-kick-anim -verbose -feature WindowsHypervisorPlatform -avd Pixel_API_27 -prop monodroid.avdname=Pixel_API_27                              

This example assumes that the Android SDK is installed at the default location of C:\Program Files (x86)\Android\android-sdk; if not, modify the higher up path for the location of the Android SDK on your computer.

When yous run this command, information technology will produce many lines of output while the emulator starts upwardly. In particular, lines such as the following instance will exist printed if hardware acceleration is enabled and working properly (in this example, HAXM is used for hardware acceleration):

                emulator: CPU Dispatch: working emulator: CPU Acceleration condition: HAXM version vi.2.1 (four) is installed and usable.                              

Viewing Device Managing director logs

Ofttimes you lot tin can diagnose emulator problems past viewing the Device Managing director logs. These logs are written to the following location:

C:\Users\username\AppData\Local\Xamarin\Logs\16.0

You lot can view each DeviceManager.log file by using a text editor such equally Notepad. The following example log entry indicates that HAXM was not plant on the estimator:

                Component Intel x86 Emulator Accelerator (HAXM installer) r6.ii.1 [Extra: (Intel Corporation)] not present on the organization                              

Deployment problems on macOS

Some error letters may be displayed by the emulator when you deploy your app. The most common errors and solutions are explained below.

Deployment errors

If you meet an error about a failure to install the APK on the emulator or a failure to run the Android Debug Bridge (adb), verify that the Android SDK can connect to your emulator. To verify connectivity, use the following steps:

  1. Launch the emulator from the Android Device Manager (select your virtual device and click Get-go).

  2. Open up a command prompt and become to the folder where adb is installed. If the Android SDK is installed at its default location, adb is located at ~/Library/Developer/Xamarin/android-sdk-macosx/platform-tools/adb; if not, modify this path for the location of the Android SDK on your computer.

  3. Type the following command:

                        adb devices                                      
  4. If the emulator is accessible from the Android SDK, the emulator should appear in the listing of attached devices. For example:

                        List of devices fastened emulator-5554   device                                      
  5. If the emulator does non announced in this list, first the Android SDK Manager, apply all updates, then try launching the emulator once more.

MMIO access error

If An MMIO access error has occurred is displayed, restart the emulator.

Missing Google Play Services

If the virtual device yous are running in the emulator does not accept Google Play Services or Google Play Shop installed, this condition is unremarkably caused past creating a virtual device without including these packages. When you create a virtual device (see Managing Virtual Devices with the Android Device Director), be certain to select one or both of the following:

  • Google APIs – includes Google Play Services in the virtual device.
  • Google Play Store – includes Google Play Shop in the virtual device.

For example, this virtual device will include Google Play Services and Google Play Shop:

Example AVD with Google Play Services and Google Play Store enabled

Note

Google Play Shop images are available simply for some base of operations device types such as Pixel, Pixel 2, Nexus 5, and Nexus 5X.

Performance issues

Operation issues are typically caused by one of the following issues:

  • The emulator is running without hardware acceleration.

  • The virtual device running in the emulator is not using an x86-based system epitome.

The post-obit sections cover these scenarios in more item.

Hardware dispatch is not enabled

If hardware acceleration is non enabled, a dialog may pop upward with a message such as device will run unaccelerated when y'all deploy your app to the Android emulator. If yous are non certain whether hardware acceleration is enabled on your figurer (or you would like to know which technology is providing the acceleration), encounter Hardware acceleration issues below for steps you lot can take to verify and enable hardware dispatch.

Acceleration is enabled but the emulator runs too slowly

A common cause for this problem is not using an x86-based epitome in your virtual device. When you create virtual device (run into Managing Virtual Devices with the Android Device Manager), exist sure to select an x86-based organisation paradigm:

Selecting an x86 system image for a virtual device

Hardware acceleration issues

Whether you are using the Hypervisor Framework or HAXM for hardware acceleration of the emulator, you may run into issues acquired past installation bug or an out-of-date version of macOS. The following sections tin help y'all resolve this result.

Hypervisor Framework issues

If you are using macOS ten.x or later on a newer Mac, the Android emulator volition automatically use the Hypervisor Framework for hardware acceleration. However, some older Macs or Macs running a version of macOS earlier than x.10 may non provide Hypervisor Framework back up.

To determine whether or not your Mac supports the Hypervisor Framework, open a Terminal and enter the post-obit command:

                sysctl kern.hv_support                              

If your Mac supports the Hypervisor Framework, the above command will return the following issue:

                kern.hv_support: i                              

If the Hypervisor Framework is not available on your Mac, you lot can follow the steps in Accelerating with HAXM to use HAXM for acceleration instead.

HAXM bug

If the Android Emulator does non commencement properly, this problem is frequently caused by bug with HAXM. HAXM issues are often the result of conflicts with other virtualization technologies, wrong settings, or an out-of-appointment HAXM driver. Effort reinstalling the HAXM commuter, using the steps detailed in Installing HAXM.

Additional troubleshooting tips

The following suggestions are ofttimes helpful in diagnosing Android emulator bug.

Starting the emulator from the command line

If the emulator is non already running, you lot can start information technology 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

Yous can launch the emulator with an AVD prototype from this location by passing in the binder proper name of the AVD. For example, this command launches an AVD named Pixel_2_API_28:

                ~/Library/Developer/Xamarin/android-sdk-macosx/emulator/emulator -partition-size 512 -no-boot-anim -verbose -characteristic WindowsHypervisorPlatform -avd Pixel_2_API_28 -prop monodroid.avdname=Pixel_2_API_28                              

If the Android SDK is installed at its default location, the emulator is located in the ~/Library/Developer/Xamarin/android-sdk-macosx/emulator directory; if not, modify this path for the location of the Android SDK on your Mac.

When you lot run this control, information technology will produce many lines of output while the emulator starts up. In particular, lines such equally the following instance volition exist printed if hardware dispatch is enabled and working properly (in this case, Hypervisor Framework is used for hardware acceleration):

                emulator: CPU Dispatch: working emulator: CPU Acceleration status: Hypervisor.Framework Bone 10 Version 10.xiii                              

Viewing Device Managing director logs

Ofttimes yous can diagnose emulator issues past viewing the Device Managing director logs. These logs are written to the post-obit location:

~/Library/Logs/XamarinDeviceManager

Y'all can view each Android Devices.log file by double-clicking it to open up it in the Console app. The post-obit example log entry indicates that HAXM was non establish:

                Component Intel x86 Emulator Accelerator (HAXM installer) r6.2.i [Extra: (Intel Corporation)] not present on the system