My Android emulator runs very slow on my Ubuntu machine. I need it to run faster, because some apps are slowed down so much, that they change their behaviour (they use the camera).
System specs:
-x86_64
-Intel(R) Core(TM) i7-5600U CPU # 2.60 GHz
-20GB Ram
-512Gb HDD
I use Ubuntu 20.04 and Android Studio 4.1.1 (fresh installation).
I use this AVD: Pixel2 1080 x 1920: 420dpi API 28 Android 9.0 (Google X86_ARM) CPU/ABI: x86
In the extended menu I chose Graphics: Hardware - GLES 2.0. I also disabled GPS, audioInput and audioOutput with no performance improvements.
I did not try this, because selecting Hardware - GLES 2.0 worked for me and the avd started normally (but still very slow).
Other system images are equally slow though.
I tried:
sudo modprobe msr
sudo rdmsr 0x3A
and it returns 5, so VT-X is enabled
Is the hardware the bottleneck, or is something configured wrongly? Maybe it is the HDD that slows the emulator down? I tried running the emulator on Windows and it's insanely fast. The windows machine is stronger though.
Update 11.12.2020:
I also verified my KVM installation using this command:
./emulator -avd Pixel2Api28Arm -accel-check
It returned this:
28Arm -accel-check
accel:
0
KVM (version 12) is installed and usable
accel
So this does not seem to be an issue.
I was having the same problem (KVM working, but slow x64 emulator on x64 host), and found a solution here, which is to disable automatic snapshot creation.
Run your emulator, and click on the three dots (...) to open the settings:
In the settings, click "Snapshots":
Switch to the "Settings" section on top:
Set "Auto-save current state to Quickboot" to No:
It'll ask you to restart the emulator, click Yes:
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
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.
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!
Starting with Android SDK Tools rev 17 the Android emulator supports using the hardware virtualization feature (Intel VT, VT-x, vmx and AMD-V, SVM) which should speed-up x86 based emulator images a lot: http://developer.android.com/guide/developing/devices/emulator.html#accel-vm
I installed all necessary components:
The newest SDK tools
The Intel Hardware Accelerated Execution Manager (and installed it by executing IntelHaxm.exe)
Intel Atom x86 System Image (available as API 10 and API 15 image)
Then I created a new AVD using that image, but I could not "feel" any difference regarding the execution speed.
Therefore my question is: How to find out if hardware virtualization feature is used?
And if not what needs to be done to use it?
I know that it is enabled by the BIOS, because I can run Windows 64 bit VMs in VirtualBox.
Additionally I have verified it using the Microsoft® Hardware-Assisted Virtualization Detection Tool.
During emulator loading you should see this line:
[2012-03-26 14:06:22 - Emulator] HAX is working and emulator runs in fast virt mode
After steping through this tutorial on OS X Lion, I see the following in the console, when starting the emulator:
./emulator-x86 -avd Test3
HAX is working and emulator runs in fast virt mode
Had the same issue on Windows 7 32bit with Q6600 Intel processor and pretty outdated Asus P5E-VM SE motherboard.
The motherboard did not even have a switch for virtualization, though Intel tool:
http://www.intel.com/support/processors/tools/piu/sb/CS-014921.htm
indicated that VT technology is enabled.
The culprit was that Data Execution prevention was enabled only for windows services, I have enabled it for all programs and after computer restart received this message in the Android Console of the Eclipse:
HAX is working and emulator runs in fast virt mode
DEP setting is located:
Located Windows/Control Panel/System&Security/System/Advanced System Settings/Advanced tab/Performance/Data Execution Prevention tab
The idea to check it I received here: https://developer.tizen.org/sdk/haxm
Though only used standard images (not Tizen ones).
Have to say that loading of the emulator in the virtualization mode is not nearly as impressive as on Intel promo video: http://www.youtube.com/watch?v=pt9IeJ777zw
But uploading of the application (mine is pretty big ~5MB) and general responsiveness of the emulator is quite significant. One cannot say that it works as native computer (that it sometimes there is a visible lag), but again it is visibly faster.
It eats a lot of memory though (I have 4 GB, only 14MB is free when emulator will run).
A quick solution for Windows platform, Launch CMD as an administrator and type this command
SC query INTELHAXM
And you should see output like this (if hardware acceleration is up and running)
SERVICE_NAME: intelhaxm
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0