How to Run Android Studio (Android Sdk Emulator) in a Microsoft Hyper-V Virtual Machine

Can I run Android Studio (Android SDK emulator) in a Microsoft hyper-v virtual machine?

Refer to this link:
How to run Android Studio on Windows without disabling Hyper-V

The solution (if you do not want to disable Hyper-V) is to use Microsoft’s Android emulator, which is a free download here.

In order to use this with Android Studio, you need to run the emulator first. Then, in Android Studio, go to Run > Edit Configurations... and select Show Device Chooser Dialog under Deployment Target Options.

Run your project, and select the VS Emulator, ignoring the invitation to “Turn off Hyper-V”.

Android Studio Emulator is not working on Windows 11 using WHPX

Final Update:

As stated by Георги Ангелов:

The latest version of Android Emulator - 31.1.2 is fixing the issue. Update through SDK Manager. Released 11/11/2021.



Update:

As stated in Mark Wood-Patrick answer, the emulator hasn't been updated yet but you can download the new emulator binaries with the fix!

From https://issuetracker.google.com/issues/202188690#comment48

windows: https://dl.google.com/android/repository/emulator-windows_x64-7869535.zip

linux: https://dl.google.com/android/repository/emulator-linux_x64-7869535.zip

macosx: https://dl.google.com/android/repository/emulator-darwin_x64-7869535.zip


WHPX as of now is not working with Windows 11, I will update this answer when it gets fixed.

There are two possible workarounds:

Disable Hyper-V (Keep in mind WSL2 or any VM won't work without this)

To disable Hyper-V you must follow these steps:

  1. Open Turn Windows features on or off.
  2. Uncheck Hyper-V and Windows Hypervisor platform (it may be required to uncheck Windows Sandbox).
  3. Open Android Studio and SDK Manager.
  4. In SDK tools, install Android Emulator Hypervisor Driver for AMD Processors (installer).


Open the emulator with no acceleration

  1. Open a terminal.
  2. Enter cd C:\Users\User\AppData\Local\Android\Sdk\emulator\ with your user.
  3. Enter .\emulator.exe -avd Pixel_4a_API_30 -accel off with your AVD device name.

Not possible to run Android Studio and Docker on Windows because of Hyper V

This is a common problem for computers without an "Intel" processor. Install any emulator with Genymotion (VirtualBox optional) because currently the new versions of docker no longer require VirtualBox.

Although if you are very lucky and / or have a computer with an intel processor, simply activate virtualization from BIOS.

Tutorial:
https://www.youtube.com/watch?v=MOuTxfzCvMY

Can not start android emulator - Hyper V detected but Hypervisor platform is not available

It's very weird but still to this day I can't start the android emulator in VS2019. However, I found a workaround - I can start the android emulator in VS2017, so I start it there and run the app from VS2019. Extremely weird, but if anyone is having that issue and needs a workaround urgently, that's what you can do.
I don't know if this is helpful at all, but as for today, that's the only solution I found.

(Also, consider switching to VS2022. Seems to work fine there as well)

How to use Android Emulator on AMD Ryzen (Android Studio)?

For Ryzen on Windows 10, use the latest stable instead of canary.

  1. Enable virtualization in BIOS.
  2. Remove HAXM.
  3. Turn off Hyper-V, Windows Hypervisor platform, Windows Sandbox(depends on your windows version, old versions may not have all). REBOOT

screenshot

  1. Launch SDK Manager via Android Studio and you should see "Android Emulator Hypervisor Driver for AMD Processors". Check and click "Apply". The SDK Manager will download the installer package and unpack it to $ANDROID_SDK_ROOT\extras\google\Android_Emulator_Hypervisor_Driver. driver

Then,

  1. Open a Windows command console with administrator privileges.
  2. Go to $ANDROID_SDK_ROOT\extras\google\Android_Emulator_Hypervisor_Driver.
  3. Run silent_install.bat. Make sure you see the desired output from the installer: STATE: 4 RUNNINGresult

Can't run Android Studio Emulator on AMD - ERROR: x86

After plenty of research I found a solution for my ryzen system:
Sample Image
(source: https://github.com/intel/haxm/issues/105)

Turn this windows setting on and somehow it will work. Don't ask me why.

I also found an official new amd driver: https://androidstudio.googleblog.com/...
But I was already using the new driver. It did only work after I switched the setting above.



Related Topics



Leave a reply



Submit