问题描述
目前我一直在通过 Android Studio UI 的 Tools > 管理 AVD.AVD 管理器.这适用于创建具有特定硬件配置文件(我在 XML 文件中)的 AVD,但我发现 AVD 经常以某种方式中断.AVD 旁边是Repair".UI 中的选项,并且我添加的硬件配置文件被删除,导致我再次输入它.这是痛苦和频繁的,所以我想通过命令行自动化它.
Currently I've been managing AVDs via the Android Studio UI at Tools > AVD Manager. This works for creating an AVD with a specific hardware profile (that I have in an XML file), but I find that frequently an AVD is breaking somehow. Next to the AVD is a "Repair" option in the UI, and the hardware profile I've added gets removed, causing me to enter it all in again. This is painful and frequent so I'd like to automate it via the command line.
我可以使用 avdmanager create avd -n test1 -k "system-images;android-29;google_apis;x86"
之类的命令创建 AVD,但它会提示输入自定义硬件,并且如果我选择自定义硬件配置文件,它会提示我输入每个单独的属性.这比使用 UI 更耗时.
I can create an AVD using a command like avdmanager create avd -n test1 -k "system-images;android-29;google_apis;x86"
, but it prompts for custom hardware, and if I choose a custom hardware profile it prompts me to enter in each individual property. This is more time-consuming than using the UI.
此来源 声称android 工具允许您为虚拟设备设置硬件仿真选项",并提供了一个可以修改的属性列表,但没有说明如何通过命令设置这些属性.
This source claims "the android tool lets you set hardware emulation options for virtual device", and provides a nice list of properties than can be modified, but no explanation of how these can be set via a command.
有没有什么方法可以从命令行为 AVD 设置硬件配置文件,而无需手动回答提示?
Is there some way to set the hardware profile for an AVD from the command line without manually answering prompts?
推荐答案
您能否尝试修改 AVD 配置文件 config.ini 以获得需要修改的所需 AVD.复制现有的 AVD,对硬件配置文件进行必要的更改并将其用作基础
Could you please try modifying the AVD configuration file config.ini for the required AVD that needs to be modified. Copy an existing AVD, make necessaryy changes to hardware profile and use it as base
参考:
https://developer.android.com/studio/run/managing-avds#copyavd
https://stuff.mit.edu/afs/sipb/project/android/docs/tools/devices/managing-avds-cmdline.html#hardwareopts
https://developer.android.com/studio/run/managing-avds#hardware-profile
这篇关于如何使用硬件配置文件从命令行创建 AVD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!