Android AVD set custom hardware

情到浓时终转凉″ 提交于 2021-02-07 03:17:17

问题


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.

  1. As a command line flag:

    $ emulator -avd <name> -noaudio
    
  2. By editing ~/.android/<name>.avd/config.ini and replacing this line:

    hw.audioInput=yes
    

    with these two:

    hw.audioInput=no
    hw.audioOutput=no
    
  3. 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.

  1. Requires to pass the -noaudio flag each time. This means it can't be run from AVD manager.
  2. config.ini is reset each time an edit is made using AVD manager.
  3. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!