Android emulator uses 100% cpu even if nothing i r

2019-01-22 02:03发布

问题:

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!

回答1:

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



回答2:

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.



回答3:

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).



回答4:

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



回答5:

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.



回答6:

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.



回答7:

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/



回答8:

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.



回答9:

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.



回答10:

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.