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 created an emulator via Android studio AVD.
when i run the emulator, it show a message saying
your gpu driver information :
make:8086
Model:Intel (R) HD graphics 4000
device id :0166
Some users have experienced emulator stability issues with this driver version. As a result, were selecting a compatibility renderer. Please check with your manufacturer to see if there is an updated driver available.
https://i.ibb.co/60pY4pm/emulator2.jpg
I Added Android Studio to my nvidia card to run automatically on GPU driver whenever i open android studio
I Also added emulator executive files to nvidia card control
So it supposed that the emulator run on My nividia GT 365M not intel 4000
http://i63.tinypic.com/5bd7vk.jpg
But same message appear and my emulator is extremely slow
it is on that stage after 15 min of running
http://i66.tinypic.com/2zfv2hz.jpg
I tried every single option in emulator setting
http://i68.tinypic.com/71jpm0.jpg
***I tried to run the emulator by command line
emulator -avd pixel -gpu on
But the same problem
**** I enabled Intel HAXM (intel hardware acceleratio),,,nothing changed
********I ensured that my nividia card Driver is up-to-date
My Laptop Specs
CPU Intel Core i5 (3rd Gen) 3210M / 2.5 GHz
*Number of Cores Dual-Core
*Cache 3 MB
*Ram: 6 GB
*Graphics Processor Intel HD Graphics 4000
*Graphic card : nVidia GT365M
What is the solution ?
problem solved by installing intel 4000 graphic card update
https://downloadcenter.intel.com/product/81499/Intel-HD-Graphics-4000
but I still think my emulator runs on Intel card not GPU nividia card
any solutions for that ?
I know this is a duplicate but i am unable to comment on this thread in order to find out a solution. I have done exactly as the accepted answer but my problem isn't solved.
I am running Ubuntu 17.04 on a laptop with Intel Core i7 4th Gen Processor, 8GB RAM, 256GB SSD and Dual Graphics.
I have installed nVidia Prime drivers and switched to Intel graphics card because it performs better than the nVidia.
I have created a Virtual Device with the following settings:
Device: Google Pixel with API 26
Graphics: Automatic(i have tried both software and hardware btw).
RAM: 4096MB
VM Heap: 1024MB
Internal Storage: 4096MB
First, reduce the RAM of the emulator image to something more reasonable (1024MB, perhaps 1536MB). Do not allocate half of your development machine's RAM to an emulator.
Second, confirm that you are using an x86 emulator image (or perhaps x86-64). This shows up in the CPU column of the AVD Manager.
I am using Android Studio in Windows 8.1 with 4 GB RAM; given 2 GB to virtual memory. But when ever I run the emulator I get the following:
C:\Users\CSE\AppData\Local\Android\sdk\tools\emulator.exe -avd Android_API_21 -netspeed full -netdelay none
emulator: device fd:828
HAX is working and emulator runs in fast virt mode
emulator: warning: opening audio input failed
creating window 0 0 384 729
emulator: emulator window was out of view and was recentered
The emulator starts and suddenly stops showing massage:
emulator-x86.exe has stopped working
I have edited the current device & also created new AVD with resolution 800x600 and RAM 512 MB ( & less ) but nothing works. HMAX is installed.
Suggestions will be really helpful. Thanks in advance.
Here is how I solved in a laptop with Windows 10 + HAXM enabled, to run the default "Nexus 5 API 23 x86" Device.
My laptop has 2 video cards, the integrated Intel HD 3000 and a GeForce 525M.
On NVIDIA Control Panel, switch "Preferred graphics processor" to Auto-select or Integrated graphics.
The emulator doesn't work here when I set the NVIDIA GPU as preferred.
Check this path
C:\Users\Username.android\avd. Edit the file emulator-user & set the window.x = 0, window.y = 0
Create the hdpi virtual device like Nexus S 4.0 480x800 hdpi.
In AVD Manager, Select your device which is stopped. And click the edit in the right side of the wizard. It shows the options and features of your current device like ROM size, Internal and External Storage etc.
Uncheck the Use Host GPU.
In that wizard select Show Advanced Settings -> Memory and Storage -> RAM: 764MB
VM heap: 32MB
Internal Storage: 200MB
Change these settings and restart your Android Studio
I'm trying to create an emulator with 2047 mb ram.
When I run it, I get this error:
[2011-02-22 14:24:14 - Emulator]
[2011-02-22 14:24:14 - Emulator] This application has requested the Runtime to terminate it in an unusual way.
[2011-02-22 14:24:14 - Emulator] Please contact the application's support team for more information.
[2011-02-22 14:24:26 - Emulator] Failed to allocate memory: 8
I understand that lowering the number will make it work. But I'd rather have it with more ram, so I can test a game I'm developing. I'm assuming with more ram, it would run faster...
Has anyone got 2047 mb of ram on the emulator? If so, how? What settings did you use? Did you change anything special on your computer?
Using windows 7 64-bit, updated to the latest android sdk. Also I have over 8gb of ram available. I do have one device (motorola milestone) to test on, however since it is a network-based game I need at least one other client (hoping to use the emulator) to run with in addition to my phone.
Solution to running a faster emulator:
http://androiddevnotes.com/2011/03/08/1299521520000.html
Runs my game a lot faster, comparable to phone quality.
-- Update 08/24/12 --
I see that people still come here and comment on this answer, and I have done more research on this issue. I present to you the results of my findings.
NOTE: These tests were run on my computer, your computer may be different.
Running an Android 2.2 (armeabi) emulator with Property 'Device ram size' = 2048 will
fail, just as before
Running an Android 2.2 (armeabi) emulator with Property 'Device ram size' = 2048 MB will pass, however if you actually check the ram on the device, its around 128 MB.
check 1: Settings > Applications > Running Services - add all the numbers on the bottom of the screen
check 2: run the following command in adb shell: cat /proc/meminfo/ and note the MemTotal field
Running an Android 4.1 (armeabi-v7) emulator with Property 'Device ram size' = 2048 will work, however if you actually check the ram on the device its around 512 MB
check 1: Settings > Apps > Running tab - add all the numbers on the bottom of the screen
check 2: run the following command in adb shell: cat /proc/meminfo/ and note the MemTotal field
Running an Android 4.1 (armeabi-v7) emulator with Property 'Device ram size' = 2048 MB will work as well, but with the same results as 3.
Conclusion
Adding 'MB' as noted in some of the comments below may allow your device to be launched, however it doesn't actually have 2 GB of RAM. Even with a 4.1 Emulator, the RAM Size is at 512 MB.
Recommendation
Please use an actual device for testing.
I also get this error. Use RAM 512.
I was also getting this error message after upgrading my Android ADK Tool to 20 (even though I have more than sufficient RAM). No changes made to the 'Device RAM size' property helped (whether higher or lower, or with "MB").
What did work for me is running the emulator at the command line and specifying the RAM amount there (less than the default in my case); for example:
emulator -memory 512 -avd my_avd
Add in Run Configurations window the parameter
-memory 512
See screenshot for reference
Solution is that you go and edit the config file for that perticuler avd in .android folder in your user folder in c drive
with RAM = 1024 MB instead 1024
The problem is MB is not there...
I had the same problem but then figured it out. The problem was in the amount of ram I had specified for the virtual machine, and it was 1024MB by default, now I changed it to 512MB and it works; though my pc has 8GB of RAM.
I had the same issue but before I got the issue it asked me to capture a video source. I disabled the camera support and I was able to use 1024MB of RAM. Using Windows 64bit, Xoom (Android 3.0). i hope this helps for anyone with the same problem.
Edit the Device settings and change the RAM allocation to a lower number. If it was 1024 or More, reduce it to 512Mb or 256Mb.
You can Change it in "Edit Android Virtual Device (AVD)" dialog's Hardware Section --> Device ram size
I changed my monitor's DPI settings from the launch options of AVD and syncronized it with the original and current setting of my monitor, and it works for me.
I was getting "failed to allocate memory: 8" errors as well. I have W7-64bit and 8GB of RAM. I found that by running AVD "as Administrator" the error disappeared, allowing the emulator to launch.
Simple computer reboot helped me after I installed HAXM and got that error :)
I had to do this Go to "Tools -> Android -> AVD Manager -> Chose your device -> Edit -> Advanced Settings -> Change the RAM parameter to 512 Mb.