问题
I am trying to decrease the ridiculous CPU usage of my Android emulator.
Thanks to this answer I found out that the CPU usage can be greatly decreased by disabling audio.
Solutions
I found out there are three ways to run the emulator without audio.
As a command line flag:
$ emulator -avd <name> -noaudio
By editing
~/.android/<name>.avd/config.ini
and replacing this line:hw.audioInput=yes
with these two:
hw.audioInput=no hw.audioOutput=no
Instead of using the graphical AVD manager, use the following command to create an emulator:
$ android create avd -n <name> -t <target>
Cons
All of these methods have downsides though.
- Requires to pass the
-noaudio
flag each time. This means it can't be run from AVD manager. config.ini
is reset each time an edit is made using AVD manager.- Requires to explicitly set every property of the device instead of just being able to use a preset configuration.
Attempted (failed) solution
I decided it might help to just clone an existing device and disable the audio there.
However¸ this just created ~/.android/devices.xml
and I couldn't fine any reference how to disable audio by default nor any ini
files containing hardware definitions.
Question
Is it possible to create a predefined hardware configuration that has sound disabled by default? If so, how?
来源:https://stackoverflow.com/questions/31893571/android-avd-set-custom-hardware