Android emulator on Hyper V – how to get hardware acceleration - android-studio

Microsoft recently announced support for running android emulator on hyper V.(https://blogs.msdn.microsoft.com/visualstudio/2018/05/08/hyper-v-android-emulator-support/)
I am trying to start the Android emulator 27.2.9.0 on my Windows 10 (April 2018 Update) Hyper V enabled machine with the following command :
> cd C:\Users\<username>\AppData\Local\Android\sdk\emulator
> emulator -avd <avd name> -feature WindowsHypervisorPlatform
And I am getting the following error message:
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable.
CPU acceleration status: Please disable Hyper-V before using the Android Emulator.
Start a command prompt as Administrator,
run 'bcdedit /set hypervisorlaunchtype off', reboot.
I have added the "WindowsHypervisorPlatform = on" line to C:\Users<your-username>.android\advancedFeatures.ini, but that didn't help.
What am I missing?

Well, it turned out that I had "Hyper-V" enabled, but "Windows Hypervisor Platform" was not enabled. (Who knew these are two different things!). Once it was enabled the emulator started to work.

I just had to uninstall the "Hyper-V Hypervisor" and the emulator started working. I'm using Windows 10 (1803). The emulators stop working if I install "Hyper-V Hypervisor".

With latest Android Studio, you do not need Hyper-V on AMD.
Just enable "Windows Hypervisor Platform" (turn windows features on and off screen) and x86 images should automatically become usable

There are a few things I did to get this working on my pc.
Install Visual Studio 15.8 Preview 1 or later
Remove and Reinstall the emulator within the Visual Studio Preview
I removed HAXM from the "Extras" within the android sdk manager (from
the visual studio menu).
The path for the advancedFeatures.ini is C:\Users\Your Username\advancedFeatures.ini to set WindowsHypervisorPlatform = on
Open Turn Windows features on or off and select Hyper-V and the Windows Hypervisor Platform checkboxes. (Requires restart)
There is another guide from Microsoft here: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin

Run the below command in cmd opened as Administrator to disable hyper-v and then reboot the machine:
bcdedit /set hypervisorlaunchtype off
This command works for me.

Related

Android Studio emulator on amd with Windows 10 Home

Is it possible to run an android emulator with Android Studio if i have an AMD processor and windows 10 Home? When i try to install HAXM i got the error "This computer does not support Intel Virtualization Technology (VT-x) or it is being exclusively used by Hyper-V. HAXM cannot be installed." from what i understood HAXM is only available for intel processor or if you have Hyper-V, but Hyper-V is not available for Windows 10 Home.
enabling Windows Hypervisor Platform in windows features worked for me
After running the script from the link below, Hyper V has been installed successfully
But in order to start the Hyper V go to:
Start Menu –> Windows Administrative Tools –> Hyper-V.
https://www.itechtics.com/enable-hyper-v-windows-10-home/
Thank you all for your help.

App Development using AMD | Visual Studio Code / Android Studio

Important: I have AMD Cpu and Windows 10 Home.
i want to start developing an app with flutter. I want to use Visual Studio Code or Android Studio as IDE.
But when i create a new virtual device and try to run it. Android Studio says:
"Intel HAXM is required to run this AVD.
HAXM is not installed. Install Intel HAXM for better emulation performance."
But if i continue with the install, it says error1 or error2
The log file suggestet in error2 says see here on screenshot
..
I also tried with Hyper-V but this doesn't work because I dont have have the Hyper-V folder installed.
I guess that's because i am using Windows 10 Home (the free one) and not Pro.
I also tried to activate SVM in die UEFI, it was already activated.
Update
Because i am using AMD cpu and don´t own Windows 10 pro license.
There was no other way than to buy an intel processor or to buy windows 10 pro.
That's why i decided to upgrade windows, now it is working with Hyper-V...

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

I try to build Android app from Android Studio.
I tried to install HAXM from Android Studio installer but I've an error:
Intel Virtualization Technology is already enabled in my BIOS. And the Hyper-V is already disabled on Windows 10.
For Ryzen on Windows 10, use the latest stable instead of canary.
Enable virtualization in BIOS.
Remove HAXM.
Turn off Hyper-V, Windows Hypervisor platform, Windows Sandbox(depends on your windows version, old versions may not have all). REBOOT
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.
Then,
Open a Windows command console with administrator privileges.
Go to $ANDROID_SDK_ROOT\extras\google\Android_Emulator_Hypervisor_Driver.
Run silent_install.bat. Make sure you see the desired output from the installer: STATE: 4 RUNNING
I just purchased a Ryzen 5 laptop with Vega 8 video and was having alot of problems running the Android Studio emulator; in the end the problem was resolved and it was very simple.
Enable SVM or other virtual machine setting in the BIOS.
Disable all hypervisor and virtual machine features by going to "Turn features on / off" in windows.
Ensure you checkmark the AMD driver and uncheck HAXM in "SDK Tools" is SDK Manager.
And most important:
It is said that the latest update of Android Studio automatically installs the AMD driver once selected, however I found this not to be the case so the last step you need to do manually just to make sure.
Run: C:\users\username\AppData\Local\Android\Sdk\extras\google\Android_Emulator_Hypervisor_Driver\silent_install.bat
Late to the party but if there are more like me who never got this to work, this got it to work: https://www.py4u.net/discuss/646511
If you tried everything (turning windows features off, enabling svm in bios..etc) and still didn't work, type bcdedit in the command prompt, and press ENTER. If you see an entry for hypervisorlaunchtype set to Auto, Hyper-V is still enabled. You can try setting the launch type to Off by running the command below.
bcdedit /set hypervisorlaunchtype off
Use the Android Studio Cannary for this. I was with the even issue and it fix for me. Watch the video for help to configure it.
https://www.youtube.com/watch?v=57vZtl5l9hk

/dev/kvm not found in Android Studio (Windows 10)

I was using Android studio on windows 8.1 and it was working fine. Now I upgraded to windows 10 with a clean install and installed android studio. When I open AVD manager and creates a new emulator, it says /dev/kvm not found. I tried these after googling but nothing worked for me-
Go to sdk\extras\intel\Hardware_Accelerated_Execution_Manager and install intelhaxm-android.exe
Download a fresh copy of Intel HAXM and install, but it says failed to configure driver: unknown error. failed to open driver.
Re-install HAXM from SDK manager, but it says Windows blocked the installation of a digitally unsigned driver. Uninstall the program or device that uses the driver and check the publisher's website for a digitally signed version of the driver
Downloading workground patch for HAXM, extract to haxm folder and Run as administrator.
My System
OS- Windows 10
Processor- Intel Core i3 third gen
Intel Virtual Technology already enabled from bios.
Hyper-V is also unchecked
I found that, when I start my PC by disabling driver signature enforcement, the emulator is working fine..
At least its solved i justa instled the new HAXM version 6.0.4 at this will work:
Here is the link:
HAXM v6.0.4

Emulator on Android Studio and Windows Phone

i think i have a huge problem...actually I'n developing on Android and Windows Phone, first with Android Studio i dont have nay problems... but with de WP emulator (VS Express 2012 SDK) I have problems with de Hyper-V... I update my OS to Windows 8.1 to solve it...but now Android I have problems with Studio emulator!! is this :
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!
ok.. it's fine...but one solution is to reinstall the Intel x86 Emulator Accelerator (HAXM installer) but when i made this i have to disable de Hyper-V!!! so not WP emulator! What can i do to work the both emulators????
Your problem is that the Windows Phone emulator requires Hyper-V to be enabled, which is incompatible with AVD using Intel HAXM. There are two options:
Use the Visual Studio Emulator for Android, which can
connect to your Android Studio project via ADB (build your APK and
adb.exe push) and is a Hyper-V-based, x86 emulator, so it can run
side-by-side with the Windows Phone emulator.
Enable/disable Hyper-V whenever you switch between platforms (this requires a reboot every time you go from WP -> Android or vice versa)
can you just switch per boot - the two commands would be
bcdedit /set hypervisorlaunchtype off
bcdedit /set hypervisorlaunchtype auto or you could use net start hvboot

Resources