47

I have a celeron processor :/ and android emulator on eclipse uses 100% of cpu and hangs everything unless I kill it . I was just trying a hello android program from a book and don`t know much about android or even eclipse .I have the android-eclipseplugin installled .

Can someone help me with is ?thanks!

user882440
  • 555
  • 1
  • 5
  • 7
  • I am not sure if it will help you, but I had a similar problem and this is how I fixed it https://stackoverflow.com/a/53212413/2658949 – arenaq Nov 08 '18 at 16:49
  • 2
    Does this answer your question? [High CPU usage with Android emulator (qemu-system-i386.exe)](https://stackoverflow.com/questions/37063267/high-cpu-usage-with-android-emulator-qemu-system-i386-exe) – zwebie Jan 21 '20 at 08:20

10 Answers10

72

As others have said, the solution is disabling sound. Unfortunately, in recent Android Studio releases (I'm using 1.4) the option to disable sound has been removed from the GUI. To disable sound you can do it either by launching the emulator from the command line with the -noaudio flag, or by editing the AVD's config file and setting the following parameters:

hw.audioInput=no
hw.audioOutput=no

On Linux, I found that file at ~/.android/avd/myAVD.avd/config.ini

IanB
  • 2,642
  • 22
  • 25
  • 5
    It's located in the same `~/.android/avd//config.ini` location on macOS. You may need to add the `hw.audioOutput` line, as it is not included by current (2017-01) AVD editor. Worked like a charm for me too: from 145% CPU down to 30% (Macbook Pro early 2016). – FGM Jan 15 '17 at 20:27
  • 1
    On Windows, the file is located at: `c:\Users\\.android\avd\\ ` Also, just setting `hw.audioInput=no` was enough. – Jan Kalfus Feb 08 '17 at 19:37
  • 3
    This is NOT a solution to the problem, it is a work-around. – Aaron Franke May 12 '17 at 01:08
  • 1
    This does not disable audio for me. – keoni29 Jul 10 '18 at 18:08
  • Same here, it does not disable the audio in Ubuntu 18.04 – Seven Oct 16 '18 at 17:05
44

I've had the exact same problem and found a solution that works for me. In the config of the AVD I've set an extra flag "Audio playback support" to "no". I've also made sure the AVD has 1GB of RAM.

This worked for me.

nhaarman
  • 98,571
  • 55
  • 246
  • 278
Niels Basjes
  • 10,424
  • 9
  • 50
  • 66
9

For me, it was unchecking the Multi-Core CPU check box

enter image description here

Kamen Dobrev
  • 1,321
  • 15
  • 20
5

Niels' answer worked well for me https://stackoverflow.com/a/7706018 in that the emulator stopped using 100% CPU (dropped down to 10-15%) Furthermore it had another useful "side effect". I noticed that playing video in Totem or music in RhythmBox would block while the emulator was running. VLC would play video but refuse to play the accompanying soundtrack for the video. As soon as the emulator was killed, music would start playing. Niels' answer to set "Audio playback support" to "no" prevents this issue. I am running Ubuntu 11.04 and Android emulator version 13.0 (build_id OPENMASTER-172639).

Community
  • 1
  • 1
Irfan Butt
  • 51
  • 1
  • 2
3

I had same issue on my macOS High Sierra and for me helps to create new AVD device and choose CPU/ABI = x86_64, not x86 in Android version dialog. Hope that helps.

west44
  • 747
  • 3
  • 12
  • 24
1

One alternative that worths mentioning is Genymotion. It's an android emulator based on VirtualBox, with pre-created images. It supports some features the stock Android emulator isn't very good at, like Wifi 3G, Bluetooth, GPS (with a fancy Google Maps integration, so you don't have to find coordinates manually), multiple screens, etc.

It worth giving it a try at http://www.genymotion.com/

Bolhoso
  • 895
  • 1
  • 7
  • 14
1

I had this issue running the emulator on Ubuntu 14.04. Disabling the audio does bring down the CPU usage, but in case you need audio to work, it can be fixed by adding a symlink:

sudo ln -s /usr/lib/x86_64-linux-gnu/libpulse.so.0 /usr/lib/x86_64-linux-gnu/libpulse.so

The reason for this is that the emulator tries to use pulseaudio as the backend, but will be unable to link to libpulse.so, which does not exist on Ubuntu (unless you installed the libpulse-dev package). Then it will fall back to ALSA, which constantly calls poll, causing 100% CPU usage.

A fix for the emulator is coming, but for now, adding the symlink solves the issue.

weiyin
  • 6,819
  • 4
  • 47
  • 58
1

The Android emulator is emulating an ARM CPU without hardware acceleration which can be pretty slow even on a core2duo for example.

You can try to reduce the screen resolution of the virtual device which should result in a small performance increase.

Julian
  • 2,051
  • 2
  • 22
  • 30
1

The emulator is notoriously slow to start; it can take 15 minutes or longer on an underpowered machine. You can speed start-up a bit by passing the -no-boot-anim to the emulator start-up command. Other emulator options are described here. Also, some AVDs start faster than others. Try creating an AVD with the lowest level SDK that is useful for you.

Once the emulator has started, you don't need to shut it down. When an app exits (or crashes, or whatever), you can just run it again.

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
  • I feel stupid to ask but how and where do i use these commands ?I`m n xubuntu and I only know how to start emulator while running the app .I tried to run it from terminal from the tools/ directory but it says "emulator command not found " . – user882440 Sep 04 '11 at 05:57
  • If you're using Eclipse, you can set emulator options under Window > Android > Launch. You can launch the emulator without launching an app by opening the Android SDK and AVD Manager in Eclipse (also under Window, or click the AVD icon in the toolbar). To run the emulator from the command line, make sure that `/tools` is on your path. – Ted Hopp Sep 04 '11 at 06:06
-2

I strongly recommend not to use android emulator. Use VirtualBox + android x86 OS (you can download it here ), and you will get real perfomance increase.

Unfortunately, as far as i remember, it is not from google and it supports only Android 2.2. I really do not understand, why google is not going to make simulator as fast as iPhone simulator , or to make official x86 release for debugging. I do not need emulating ARM processor instructions and I think 99% developers do no need it too.

Andrei Buneyeu
  • 6,662
  • 6
  • 35
  • 38