問題描述
目前我一直在通過 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?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!