151

The emulator qemu-system-i386.exe cpu usage almost constantly running between 7~9

Android studio 2.1 Android SDK Tools: 25.1.3 Host Operating System: Windows 7 - i7 2630QM - 8GB Ram Intel x86 Atom System Image installed

No matter what setting i change in the emulator like: emulated performance, multi-core CPU, x86-64 image, always the same thing

It is really annoying fan always on

Anyone had a fix for this issue?

electroid
  • 603
  • 8
  • 20
skystar7
  • 4,419
  • 11
  • 38
  • 41
  • 1
    Personally I prefer to use [Visua Studio Emulator for Android](https://www.visualstudio.com/en-us/features/msft-android-emulator-vs.aspx), simply because I have never seen something so efficient, both performance-wise and on using the host resources. Though it requires Hyper-V enabled on the host. – Matei Radu May 06 '16 at 02:40
  • I will give that a try right now, thanks for the advice – skystar7 May 06 '16 at 02:41
  • Sorry for the false hope but only now I found that Windows 7 does not have Hyper-V, so that emulator cannot run on your host. – Matei Radu May 06 '16 at 02:47
  • 1
    it is okay :) ... I am testing with the Genymotion plugin now https://www.genymotion.com/plugins/ – skystar7 May 06 '16 at 03:16

24 Answers24

247

The cause of the constant CPU usage could be the sound. If you do not need sound in your emulator you can disable it by editing the AVD's config file.

Change/add those two lines

hw.audioInput=no
hw.audioOutput=no

Update: As buncis commented you can also try to disable GPS if not needed:

hw.GPS = no 

On Linux/Mac the file is located at ~/.android/avd/<AVD_Name>.avd/config.ini
On Windows the file is located at C:\Users&lt;username>\.android\avd&lt;AVD_Name>.avd\config.ini

You may need to cold boot the emulator for the changes to become effective.

Benjamin Mesing
  • 4,075
  • 1
  • 18
  • 22
  • Or maybe here? ~/.android/avd/Nexus_5X_API_25_x86.ini – Stan Feb 13 '17 at 13:21
  • I think not, I believe this file has a different purpose. – Benjamin Mesing Feb 14 '17 at 07:50
  • @leanne Maybe see my answer? – antoine May 11 '17 at 22:49
  • 4
    @antoine: this actually did fix my issue - I edited the wrong config.ini file. Restarting couldn't have hurt either. – leanne May 12 '17 at 14:03
  • Ah yes, this happened to me when I had an external sound card plugged in and sorted itself out when I unplugged it. – Michael Forrest May 23 '17 at 12:19
  • this worked for me ! it was consuming more than 70% of cpu on Windows 10 – AymAn AbuOmar Feb 22 '18 at 12:58
  • 1
    Thanks! Decreased from ~50% to ~1-3% – mehmet6parmak May 19 '18 at 06:11
  • 2
    I opened a bug report to investigate more on the unusual CPU usage (linking to this answer): https://issuetracker.google.com/issues/109921752 – Sebastiano Jun 12 '18 at 08:16
  • Worked, didn't have to restart emulator either. Maybe it was coincidence, still problem is gone now. – jozols Jun 12 '18 at 10:21
  • So far it lowered my usage from 100% (on a 4 cpu system) to 30%. so better than nothing. – Fabio Jan 11 '19 at 02:19
  • When I apply the suggested changes, clicking on menu items are not working. Probably because that would give a sound, but with this setting it's blocked and onlClickListener is not triggered at all. – ktamas Feb 09 '19 at 09:59
  • 11
    also consider to disable GPS if you not using it `hw.GPS = no` – buncis Mar 18 '19 at 18:07
  • it works, but sometimes you have to also wait android to configurate, install something and let it turn on – Indigo_heart Apr 11 '19 at 11:17
  • 2
    @buncis thank you, only after disabling gps it works – Neuron Apr 11 '19 at 12:41
  • 5
    Don't forget to 'cold boot now' the device under the Android Virtual Device Manager's Menu. – S. Gissel Aug 17 '19 at 19:16
  • 1
    working great. Yeah after editing config file. please considered to use **COLD BOOT** to update config.ini file updated setting in AVD. – Ashu Kumar Jun 29 '20 at 12:35
  • I found mine at `~/.android/avd/Galaxy_Nexus_API_30.avd/config.ini`. Do I do something like `source` after editing `~/.bashrc`. It says cold boot now by @S.Gissel but in Android Studio where is that? I am on Ubuntu and using the Flutter extension on Android Studio. – mLstudent33 Aug 17 '21 at 02:56
  • I found the little icon in the top right of Android Studio for AVD manager but when I did cold boot it said `error, couldn't find adb` and launched the emulator. Looks ok so far but what is that? Sorry, found it: https://stackoverflow.com/questions/27301960/errorunable-to-locate-adb-within-sdk-in-android-studio – mLstudent33 Aug 17 '21 at 02:59
  • 1
    I changed the values and saved it. But after starting the emulator, values set back to "true". So what can i do? – Zima Oct 23 '21 at 06:33
  • Remember to set back `hw.gps = yes` if work relates to maps and current location. – themefield Aug 28 '22 at 18:19
25

On Mac I noticed that the emulator was using over 100% CPU after my laptop went to sleep. Turning the audio off as Benjamin suggested didn't fix that problem.

Restarting the simulated device by long-pressing the power button on the emulator works for me.

antoine
  • 2,036
  • 25
  • 17
22

Using the x86_64 (Or the 64 bit) emulator solved it for me. They recommend the x86 version, but it was acting up for me.

Bri6ko
  • 1,858
  • 1
  • 18
  • 29
19

To find out what on the virtual device is using the most CPU:

adb shell

$ top

This will show you a list of processes with the highest CPU usage atop.

This will help you determine whether it's a process (such as your app) inside the emulator, another process inside the emulator, or just the emulation itself using a lot of CPU.

In the latter case, try optimizing the emulator by installing HAX (Native intel instructions) or perhaps enable hardware acceleration using the AVD profile editor.

jorisw
  • 875
  • 1
  • 11
  • 17
11

I had that problem on the start of November 2018.

Virtual device was contently trying to connect to the mobile network data, so I turned it off inside of the device itself. Work great now.

s.lg
  • 111
  • 1
  • 3
11

In my case using hardware graphic solved my problem.

enter image description here

Alireza Barakati
  • 1,016
  • 2
  • 9
  • 23
9

The same problem with qemu on Win7, HAXM 7.2.0. I've tried switch off audio, it didn't help, qemu consumes about 20% of CPU anytime, Android works very slow on both x86 and x64 images.

I've found solutions in HAXM's Release Notes file:

  • On Windows, Avast Antivirus may interfere with HAXM and cause Android Emulator or QEMU to run very slowly. A workaround is to uncheck "Use nested virtualization where available" in Avast Settings > Troubleshooting.

I have Avast Pro Antivirus 18.5. I've unchecked this param, rebooted PC and now qemu consumes 0% in idle, Android works fine.

UPDATE: if QEMU started consume CPU again, first check Avast's update status. After background update Avast may start to interfere to HAXM again. Just reboot Windows to solve it.

Nexus7fm
  • 216
  • 3
  • 5
6

my case, coz I choose software for graphics rendering in adv. so after a change to the hardware reduce CPU usage from 60 to 10, and CPU temp from 70 to 40.

Baltschun Ali
  • 376
  • 3
  • 12
  • 2
    This seemed to work for me. on Software the emulator always ran ~106 all the time. Switching to hardware is runs about ~24. But can peak to over ~200 when interacting with the emulator. But will quickly go down to ~24 when not interacting. This seems to be the best solution rather then having to updated the configuration settings that you might need enabled later. – ant2009 May 30 '20 at 13:41
  • Where do I find this setting on `Pixel 4` Emulator – Tonnie Jun 09 '22 at 07:25
4

I am on macOS Catalina(Version 10.15.2) with Intel Core i9 and 16 GB RAM and Radeon Pro 560X 4GB Graphics.

I solved high CPU usage by qemu by restarting the emulated device using the emulated power button.

Also, while creating the AVD, I chose Hardware Graphics Renderer instead of Auto.

4

Using kind of old Android version I used Lollipop Galaxy Nexus API 22 dropped CPU usage from 220% to around 30% ! ...

I also switched: Emulated Performance > Graphics > Hardware

Using Android Api 25 ... Hardware for graphics and turning off AVD audio and GPS didn't work for me...

Platform: MacOS

Hend El-Sahli
  • 6,268
  • 2
  • 25
  • 42
  • Same on my side with macos. Having biggest benefit with using an api-25(x86) emulator, it's fast. Also disabling audio and gps from config is saving %5 of cpu usage over coreaudio task. It's using around %18-20 cpu on idle for an i7. api-29(x86-64) using around %40, api-30(x86-64) is killing cpu with %350. – asozcan Dec 29 '20 at 15:55
3

I reduced the CPU usage of my emulator by setting the framerate of the monitor to 60hz. It was on 144hz and my CPU was running at 60% - 70%. By only changing the framerate of the monitor, it's now sitting at 3% usage.

soniiic
  • 2,664
  • 2
  • 26
  • 40
3

I wasn't able to shut the audio off with the config.ini file, but only with the -noaudio cmd line argument to qemu. However, with Android Studio 3.2, you can't add custom arguments to the emulator, so I made this:

In the emulator dir of the Android SDK, in my case ~/Android/Sdk/emulator/

mv emulator emulator.orig

Make a bash script called emulator with the content:

#!/bin/bash

DIR=`dirname "$0"`

$DIR/emulator.orig -noaudio $*

Then:

chmod +x emulator

Now, the argument -noaudio will be added to all invocations of emulator from Android Studio and will save you a lot of CPU cycles.

3

I solved it by cancelling "Auto-save current state to Quickboot"

Snapshots -> Settings -> Auto-save current state to Quickboot - NO

Osman Yılmaz
  • 123
  • 1
  • 9
3

I had the same issue recently on Windows 10 (18363): the AVD used all of the host's 16 Threads at 100%, it seems the android.hardware.graphics.composer@2.1-service process on the AVD was to blame.

What helped in my case: going to AVD settings - Advanced - change the OpenGL ES renderer to Desktop native OpenGL and restart the AVD. Now it uses like 2-3% of my CPU resources. Hope this helps someone.

Droidman
  • 11,485
  • 17
  • 93
  • 141
  • you guys are amazing. I used all most answers written above and ur, and CPU usage went down from 80 to 30 :D :D – Ashu Kumar Jun 29 '20 at 12:32
  • Can't find this setting on my AVD, what am I missing? – Tonnie Jun 09 '22 at 07:31
  • 1
    @Tonnie provided you have the default view, here's where that setting is located: https://i.postimg.cc/Kc9fC02H/Untitled.png – Droidman Jun 09 '22 at 08:15
  • @Droidman, thanks man. Just like that the CPU is cooling down and doing below 5% of CPU usage, you are a legend! – Tonnie Jun 09 '22 at 08:20
2

Update:

I have installed Genymotion plugin at genymotion.com/plugins, and it has an amazing performance

skystar7
  • 4,419
  • 11
  • 38
  • 41
2

In my case, I only encountered this issue when running multiple instances of the emulator.

Re-run the Intel Hardware Accelerated Execution Manager (HAXM) installer provided in the Android SDK (<Android SDK path>\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe), select Change, and see how much memory is allocated to HAXM. If it's 2 GB or less, you probably want to raise it to at least 4 GB. Then restart your emulator and see if the CPU usage drops.

Austin B
  • 1,590
  • 1
  • 13
  • 25
  • I cannot access the **Change** button (it is disabled). Is there a different way to access that configuration? – polkduran Mar 29 '20 at 16:29
2

Disable location in settings and also disable touch sounds.

Waqas Shah
  • 115
  • 1
  • 6
2

In my case it was the fast boot that was causing the problem, to force into normal boot open the text file in C:\Users\<username>\.android\avd\<AVD name>\config.ini and change at least one of the values.

for example change the line

hw.battery=yes 

to

hw.battery=no
THess
  • 1,003
  • 1
  • 13
  • 21
2

In my case it was Airplane mode, when turned ON the CPU usage jumped to 99%:

adb shell

$ top

cpu usage

The issue was noticed on Android 10.0 x86. If you turn Airplane Mode OFF then the CPU usage should return to normal.

vovahost
  • 34,185
  • 17
  • 113
  • 116
  • Mine also looks like that.. User radio uses most of the cpu. But Airplane mode is OFF. I already tried turning off mobile data, wifi,...and most of the above solutions. Still no luck.. – NightOwl Oct 15 '21 at 08:40
  • 1
    @Niby I couldn't fix it but using a newer version of the API will probably resolve this so I'd suggest to use the latest available version. – vovahost Oct 18 '21 at 17:07
1

Changing the resolution worked form me. I was using 1440 x 2560 560 dpi Oreo 8.1. Now im using M-DPI Oreo 8.1

Siphamandla Ngwenya
  • 2,696
  • 1
  • 16
  • 21
1

For me I turned WIFI off and I dropped from 112% usage to 10%. I would recommend doing this

dijipiji
  • 3,063
  • 1
  • 26
  • 21
0

Just do

$adb shell
$top

Look the PID which high CPU

$kill -9 <PID>
Hà Mã Tím
  • 143
  • 2
  • 3
  • 1
    Why mostly replicate other answers? Also you should avoid kill -9. https://unix.stackexchange.com/questions/281439/why-should-i-not-use-kill-9-sigkill – Larry Shatzer Feb 22 '21 at 17:40
  • @LarryShatzer well, because it work in my context, this is not well known issue so I think it should have a full answer with step by step. – Hà Mã Tím Feb 22 '21 at 19:37
0

on api31&32: do EDIT each AVD config with Show Advanced Settings and be sure to:

  • Multi-Core CPU > max (<=> hw.cpu.ncore=8, 4/cores is not enough and may overheat cpu strongly)
  • Graphics > Hardware (GLES 2.0)
  • No-SDCard (<=> hw.sdCard=no)

enter image description here

ltlDroid
  • 31
  • 4
0

Installing (HAXM installer) from SDK tools helped me out on this

Rishabh Saxena
  • 1,765
  • 15
  • 26