I am trying to run an android emulator on an azure VM running windows, Windows 10 Pro version 1809 - But I am getting the following error message running the android emulator:
C:\Program Files (x86)\Android\android-sdk\emulator>emulator -AVD androidemulatorapi28
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure the Windows Hypervisor Platform (WHPX) is properly installed and usable.
CPU acceleration status: HAXM is not installed on this machine
The hyper-v is enabled:
And Windows Hypervisor Platform as well:
The size of the VM is D2_v3 and Dv3 - series is supposed to support Nested Virtualization. Here, here and here are claims about it being so and that android emulator functions. And as I far as I have understood:
...is part of Dv3 series.
What could be the problem?
I am able to run an Ubuntu VM in Hyper-V of the Azure Windows VM.
Disabling Hyper-V and Windows Hypervisor Platform, installing HAXM and running I get this error:
According to the writer of this medium article and this StackOverflow discussion - A special custom implementation of OpenGL is necessary - because the particular azure VM size doesn't come with a GPU. However, following the steps of the article I get another type of crash - when using the Mesa3D+LLvmpip version of opengl32.dll from the authors Github repo, replacing the OpenGL file in system32 and running the android emulator:
I found there was a gihub repo - distributing Mesa3D and LLvmpip - downloading mesa3d-19.1.3-release-mingw.exe and running the cmd file:
There is the following message in cmd:
This deployment utility targets systems without working GPUs and any use case
where hardware-accelerated OpenGL is not available. This mainly covers
virtual machines in cloud environments and RDP connections. It can be
used to replace Microsoft Windows inbox OpenGL 1.1 software render
driver with Mesa3D soft pipe, llvmpipe or SWR driver.
...which seems to be a fit for the driver rendering problem.
I was able to git rid of all cmd warnings and error by-avd myandroidemulatorapi28, and any with of following two flags -gpu angle_indirect or -gpu swiftshader_indirect. And set QEMU_AUDIO_DRV=none before running it. The GUI message about the driving issue still comes up and there is a black screen.
According to the owner of the mesa-dist-win GitHub repo - he could reproduce the GUI message diver complaint and still run the emulator successfully - when imitating the state of a VM with his machine.
Note: This is not a solution, this is for sharing details of what I learned after trying out around 10-20 ways:
To enable virtualization in azure VDI, you need to enable Hyper-V feature.
After that you can see in your task manager->Performance that the virtualization is set to true.
If not, try enabling it from command prompt.
bcdedit /set hypervisorlaunchtype auto
After that virtualization is enabled.
Now, you won't be able to install Intel HAXM, as there is a race condition between Hyper-V and Intel HAXM for virtualization.
So, Without Intel HAXM, AVD won't run.
Without Enabling Virtualization with Hyper-V, there will be just black screen in AVD, and it won't boot.
So, I believe there is no solution to this problem until now, I have search everything on google, stackoverflow. If someone finds a solution, please post it over here.
Im facing the same issue with you using Win10 or Windows Server 2019 for DV3 and EV3 series. But I got it working on ubuntu if you are open for that option. No hyper v or haxm required, it is using KVM
Just go to the link "https://github.com/intel/haxm".
Scroll down to find "Downloads".
Download the "haxm-windows_v7_7_1.zip" for windows & haxm-macosx_v7_7_1.zip for macoxs.
Install the package and it will solve the issue.
They is another android emulator that is working
https://www.sanganakauthority.com/2020/04/run-android-emulator-and-android-studio.html
Related
Setup:
Windows 11 Home 21H2 22000.132
AMD Ryzen 5900X
WSL2
Android studio lastest build (also tried with latest beta)
Problem:
As soon as I install WSL2, the emulator stops working. It's giving the following error message:
C:\Users\gusta\AppData\Local\Android\Sdk\emulator>emulator.exe -avd Android_TV_1080p_API_300
emulator: Android emulator version 30.8.4.0 (build_id 7600983) (CL:N/A)
handleCpuAcceleration: feature check for hvf
added library vulkan-1.dll
Failed to open /qemu.conf, err: 2
C:\Users\gusta\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=c0350005
C:\Users\gusta\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument
Using WSL2 at the same time as the android emulator was working before on an Intel i7 4770k processor, but stopped working after a processor upgrade to a AMD Ryzen 5900x and fresh install of Windows 11.
For clarification: I'm not trying to run the emulator from WSL2, I'm trying to run it from Android Studio. When trying to start it from Android Studio it never launches, when trying to run it from the Windows Command Line I get the above error.
The "Failed to open /qemu.conf" is possible to solve by creating that file manually, as explained by this answer. That however doesn't fix the two later errors with WHPX.
I've followed the official instructions on this page (Following the AMD with Hyper-V option WHPX). I think the problem has to do with Hyper-V running which WSL2 is using if I'm not misstaken. But according to the above link it should be possible to run the emulator at the same time as Hyper-V using WHPX. I've also tried using the Android Emulator Hypervisor Driver for AMD processors, which is giving me the exact same result.
Activated Windows features:
Thankful for any help, and please tell me if I need to add more information
Newer Answer
I found and tested in shorter toggle mechanism.
The configuration for Windows Feature:
Windows Subsystem for Linux is installed.
Windows Hypervisor Platform is installed.
Hyper-V is installed.
If you need the Emulator, you only need to turn off Hypervisor + Restart. Run: bcdedit /set hypervisorlaunchtype off
If you need the Docker back, you can run the hypervisor hence disabling Emulator. Run: bcdedit /set hypervisorlaunchtype auto
You need to restart after setting Hypervisor
You cannot run both at the same time. Another forum worth checking in How about running docker? in my older answer below.
Older Answer
I think I solved this issue, tested to run from CMD / Android Studio and ran perfectly as before installing WSL. There are several step we go:
Configuring Windows Feature:
Removed Windows Subsystem for Linux
Removed Windows Hypervisor Platform
Removed Hyper-V
Here is my current setup:
Reverting AVD setup
I know after removing there are some odds because the AVD still get the same error as before and expected to get into WSL. I stumbled and found something when ran:
C:\Users\[NAME]\AppData\Local\Android\Sdk\emulator\emulator-check.exe accel
That command will check the current accel. It explains that the Hypervisor need to be set off and give specific help:
run bcdedit /set hypervisorlaunchtype off.
After running the bcdedit, I restarted and all is reverted. Now I can run emulator both from CMD and Android Studio perfectly.
How about running docker?
Sad truth, yeah you cannot run both pararel. There are several workaround in this forum:
How can I run both Docker and Android Studio Emulator on Windows?
Several option ranging from changing emulator, add & remove docker when in need using above step, created nested vm, etc. My personal choice right now is using another Emulator for the time being and removed docker for the latter.
I finally got this working using this fix (answer number 48). Seems like a valid workaround until windows fixes this issue. I downloaded the compiled version for windows and moved it to my emulator path C:\Users\<username>\AppData\Local\Android\Sdk\emulator. Seems to be versions available for linux and mac as well but I haven't tested those.
This issue is tracked by Google bug https://issuetracker.google.com/issues/202188690
This problem only occurs with AMD processors, I have two systems both with WSL2 and Docker running on the latest Windows 11 (Insider Beta) build. One with an AMD Ryzen 5950 and one with an Intel i7-8086K.
On the Intel system the emulator runs fine with hardware acceleration together with WSL2 and Docker.
On the AMD I run into the same error when running the emulator with hardware acceleration. In the Windows 10 Insider builds before Windows 11 it still worked.
A very similar problem was introduced before in Windows 10 build 10.0.21292
and later fixed in build 21327. (https://github.com/microsoft/WSL/issues/6471) But this problem affected both Intel and AMD.
I haven't tried to turn off the AMD fTPM yet, as this is the only other change apart from updating Windows 10 Insider (dev ring) to Windows 11.
The Android Emulator Hypervisor Driver for AMD processors only works when the Windows Hypervisor is disabled, it's not used for WHPX.
The Windows Feedback is full of reports of this problem, please upvote them.
Android Studio emulator doesn't support run Hyper-V on Windows 11, we can disable Hyper-V to run but if we do that applications which require Hyper-V to run like WSL2, Docker then fail to run.
While waiting Google update Android Studio emulator support Hyper-V we have a workaround solution to run both by using another emulator which support Hyper-V like Bluestack 5 version "Nougat 64 bit (Supports Hyper-V)" at the link below
https://www.bluestacks.com/download.html
If you did all of those steps and still you are facing that emulator termination issue, then please upgrade or download your graphic card drivers and install it. After I installing Windows 11 this issue happened to my android studio emulator. Lot of steps I followed but nothing work. after that I checked my Graphic card drivers and install it. Now emulator working fine...
I installed Visual Studio last year and have been using it for .Net development. Everything has been working fine so far. I use XCode for IOS development. I want to start doing Android development. When I try to use the emulator I get the following message:
emulator: WARNING: encryption is off emulator: ERROR: x86_64 emulation
currently requires hardware acceleration! Please ensure Intel HAXM is
properly installed and usable. CPU acceleration status: HAXM is not
installed on this machine (/dev/HAX is missing).
I took its word for it and installed Intel HAXM. While installing, HAXM said it was already installed and asked if I really wanted to continue. I assumed that the previous installation had issues and told it to continue. When the dust settled I was back to where I started. Visual Studio for Mac still claims that HAXM is not installed.
What do I do now?
Android apps do run on a connected device (i.e. the problem is limited to running on emulation devices).
System Configuration:
MacOS High Sierra -
Mac Mini (Mid 2010), 2.4 GHz Intel Core 2 Duo,
16 GB 1067 MHz DDR3,
NVIDIA GeForce 320M 256 MB
This question is similar to /dev/kvm is not found. Intel HAXM is not being installed properly because it is being blocked by "Security & Privacy". OSX has a wonderful security design. If it blocks something it does not tell you. If you do something else before checking you will never know what happened because it hides the message stating what was blocked.
To address this problem re-install Intel HAXM. Open select allow Intel HAXM
In my case, I had done other things after installing Intel HAXM so I did not have the option to "Allow" it. I had to go through the complete install process again before the option appeared. In addition, I found a long list of other things that had been blocked.
I following the guide here:
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin
to run Android Emulator using Windows Hypervisor Technology. I'm currently working on Azure VM D_v3 series. During debug my sample app, I've got this error:
2>emulator: CPU Acceleration: DISABLED
2>emulator: CPU Acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
2>emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
2>Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable.
2>CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
WHPX is for sure enabled in Windows Features. Have any idea? Is it possible with azure?
Try disabling OpenGL. It worked for me in a DSv3 VM.
It can be disabled by going to Program Files (or Program Files x86 if you're on a 64-bit machine)\Microsoft XDE\10.0.10586.0\SKUs\Android\xdesku.xml and deleting this line: GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay".
If there are multiple versions under xde, pls identify which version has SKUs\Android.
Ref:
https://social.msdn.microsoft.com/Forums/en-US/d7c0bbc5-eb29-4080-8398-e55111d98c91/vs-android-emulator-cannot-boot?forum=visualstudiogeneral
Today's version of Azure VM may not have full nested virtualization capabilities enabled which may not allow Android emulator on Azure. Dsv3 or Esv3 version machines only have nested virtualization enabled. I tried and could not run Android emulator. While for now you can use Visual Studio Emulator for Android [older version of Android API]on Azure VM. Refer details for step by step guide - https://www.sanganakauthority.com/2020/04/run-android-emulator-and-android-studio.html
Here we go for GingerBread:
http://software.intel.com/en-us/blogs/2012/03/12/how-to-start-intel-hardware-assistedvirtualization-hypervisor-on-linux-to-speed-up-intel-android-x86-gingerbread-emulator/
Any updates for ICECream sandwich or Kitkat? Helpful answers are highly appreciated!!
HAXM is only needed on Windows and OS X. On Linux, you need to have KVM installed.
See the "Configuring VM Acceleration on Linux" section on:
https://developer.android.com/studio/run/emulator-acceleration#vm-linux
Just download x86 based system images in the SDK Manager, then start the AVD, KVM will be auto-detected and used automatically if your machine/system supports it.
As already mentioned by #Digit, you do not need HAXM on Linux but KVM.
Although the links in the other answers give a comprehensive answer, for those who like it short, on my Ubuntu, this was just enough:
sudo apt-get install kvm
KVM has to be enabled by inserting the kernel module:
sudo modprobe kvm-intel
How to Start Intel Hardware-assisted Virtualization (hypervisor) on Linux to Speed-up Intel Android x86 Emulator might help; verbose output is also useful for testing:
emulator -avd ... -verbose
should log something like:
emulator: CPU Acceleration: working
emulator: CPU Acceleration status: KVM (version 12) is installed and usable.
the qemuhowto states:
You must have kvm module (kvm-intel or kvm-amd) installed for your kernel, and the permission of /dev/kvm is set to allow your user to access it. Otherwise the KVM support will be disabled and it may run very slow.
here is step by step how to get KVM Installation with images
How to Start Intel Hardware-assisted Virtualization (hypervisor) on Linux to Speed-up Intel Android x86 Emulator
The Intel Hardware Accelerated Execution Manager provides hardware-assisted virtualization. It should (hopefully) work the same with more recent versions of the Android emulator. Use the Android SDK Manager to download the KitKat x86 emulator.
Here's a more recent Intel document: http://software.intel.com/en-us/android/articles/speeding-up-the-android-emulator-on-intel-architecture
and Google's documentation: http://developer.android.com/tools/devices/emulator.html
Do follow those instructions.
If it still doesn't work for you, there are many possible causes such as: not having an Intel CPU, not installed properly, need to set BIOS settings, need to reboot, need to allocate lots of memory to HAXM, need to keep the AVD memory size down, attempting to configure the emulator to use the host GPU, ...
What are the specific symptoms? Do try searching for them on Google.
Also search for Hardware Accelerated Execution Manager linux for more documentation and experience reports.
Lately Google and Intel have published a new way to run the emulator, which should work much better than the previous version (which has emulated ARM CPU). Here are some links about it: this and this.
However, after installing the new components and creating a new emulator configuration as instructed, I get an error and I also can't see any improvements. I've tried both API 10 and API 15, and with GPU enabled and disabled. None of those configurations helped. I've also tried it on two different computers and didn't get any boost (and got the same errors).
It seems that on the posts I've read about it, nobody had any problems with it and all report a much faster emulator.
The error it shows is:
emulator: Failed to open the HAX device!
HAX is not working and emulator runs in emulation mode
emulator: Open HAX device failed
Why is it happening, and is there a way to fix it? Is there anyone else who gets those errors or vice versa?
By the way, I have an Intel CPU, if that could be a problem.
EDIT:
here's what I see in the BIOS, so it should be available... :
I had the same issue, solved it by Installing the Intel Hardware Accelerated Execution Manager. Download it with the SDK Manager, it's in Extras. After this, go to the folder
[Android SDK Root]\extras\intel\Hardware_Accelerated_Execution_Manager
then run IntelHaxm.exe and install.
Here the link of the Intel Hardware Accelerated
IntelHaxm.exe for
Microsoft Windows,Mac OS* X, and Linux
Ubuntu
You'll get the following message if you don't have virtualization enabled in your BIOS:
Small Note for Windows 8 user, Intel HAX will not work if Hyper-V feature is enable. Hyper-V (like most of the virtualization tech) will exclusively lock the VT extension witch will prevent HAX to work properly. A workaround if you “need” Hyper-V too might be to stop manually the Hyper-V services when you need HAX (haven’t tested it yet through).
If all else fails. Simply try to download the Intel HAXM zip manually, extract and install.
check here
Remember this only works for an Intel cpu that supports Intel Virtualization Technology. And you MUST enable virtulization in your bios.
It's a fairly decent and very noticeable improvement to the android emulator if you ask me.
Not every processor is supporting the virtualization!
To find out your chipset abilities go to http://ark.intel.com/,
insert the name of your processor in the search line and check out the resolve.
Advanced Technologies: ...
Intel® Virtualization Technology (VT-x) = ???
If you see "No", you can forget HAXM!
Here are the steps to get the Hardware Accelerated Execution (HAX) which is really quite a lot:
1-check your processor Intel website to see if it supports Intel VT-x or not:
http://ark.intel.com/Products/VirtualizationTechnology
all Intel Core i processors and some other selected processors support Intel VT-x
2- check your bios to enable Intel VT-x , usually called hardware virtualization or Intel virtualization in bios
3- check if you are using a software conflicting with HAXM, popular software conflicting with haxm include but not limited to:
Hyper-V
Windows phone SDK 8
Avast antivirus 8
4-install Intel management engine interface (MEI), this driver is usually not installed and is not part of retailer Windows DVD, even Windows 8.
Check this post about how to install:
http://communities.intel.com/community/vproexpert/blog/2011/12/19/mei-driver-now-available-via-microsoft-windows-update
This driver is required and is not optional to activate Hardware Acceleration
you can also install it from windows update
5-use android SDK manager to download Extras -> Intel x86 Hardware Accelerated Execution Manager.
6-Run installer of HAXM from:
[Android SDK Root]\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe
if you passed the previous steps the installer will work just fine ,otherwise it will fail
7-start AVD and see the difference in performance, Animations are faster
System UI and launchers crashes in 4.0.3 but are just fine for 4.2.2
see installation guide by intel:
Using SDK Manager to download Intel HAX did not work.
Downloading and installing it from the Intel website did work.
http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/
Top Tip: making the change in my BIOS to enable virtualization and then using "restart" did not enable virtualization. Doing a cold boot (i.e. shutdown and restart) suddenly made it appear.
The first step (on Windows) is to make sure that the Micrsoft Hardware-Assisted Virtualization Tool reports that "this computer is configured with hardware-assisted virtualization".
http://www.microsoft.com/en-us/download/details.aspx?id=592
You might need to turn on virtualization in your BIOS, most manufacturers disable it by default. Intel HAX requires CPU virtualization to be enabled.
The same began to happen to me about one week ago, without apparent reason (99% sure that I didn't upgrade anything); after being able to run the emulator for some time it just stopped working without an apparent reason.
I tried to install the Intel thingie, but the installer reported that my machine doesn't support Intel VM, despite the fact that it has an Intel i3 processor and that virtualization is enabled (perhaps XP is too old an OS for that, although MS VM, Oracle's Virtual Box and VMWare have been installed an working in this machine with the same OS).
I just edited the VD to emulate an Arm processor, and everything is working again.
Perhaps not the optimal solution, but it works!
For Windows, there are some answers explained how it works. But I'm a Mac User, I don't know how to install HAX driver for Mac as they did for Windows. Finally I found the below link and it did fix my problem. You should download HAXM of Mac
and then install it.
https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement-macosx/
Complete step-by-step instructions for running the accelerated emulator can be found on the official Android developers website:
Caution: As of SDK Tools Revision 17, the virtual machine acceleration
feature for the emulator is experimental; be alert for
incompatibilities and errors when using this feature.
You have to download the Intel® Hardware Accelerated Execution Manager.
Then you will get this message:
Starting emulator for AVD 'test'
emulator: device fd:740
HAX is working and emulator runs in fast virt mode
For Mac users who want to check whether your processor supports virtualisation, use the maccpuid software and look for VMX. If it is checked then you're good to go.
Download it here
Here there are two issues we have to concentrate on:
HAX device failed to open,
For this problem, you have to run the HAX device setup file from the HAX addon folder. Follow Speed Up Android Emulator to know clearly how.
If you created the AVD through AVD manager then you can change the RAM size in AVD Manager and device edit option.
If you created the AVD through command line, then you should start the AVD from command line will work,
emulator -memory 512 -avd gtv_avd
If everything else fails, it's good to try my option and download a HAXM installer.
It needs to be copied to HAXM installation folder and then started from command line (start CMD as an Administrator). After restarting computer HAXM will be installed. It perfectly worked for me as I was having problems with installing it on my laptop.
After all simply type sc query intelhaxm in your cmd in order to check whether HAXM is installed properly.
If you are running an Intel processor make sure the HAXM (Intel® Hardware Accelerated Execution Manager) installer is installed via SDK Manager by checking this option in SDK Manager. And then run the HAXM installer ext via the path below.
your_sdk_folder\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe
Also check the RAM size allocated while doing HAX installation so it fits the RAM size of your emulator.
This video shows all the required steps which may help you to solve the problem.
This video will also help you if you face a problem after installing HAXM.
Download HAXM from the Intel site.
Install it.
And then run the AVD from AndroidStudio, menu -> Tools -> AVD. Choose x86.
It works!