問(wèn)題描述
目前我一直在通過(guò) Android Studio UI 的 Tools > 管理 AVD.AVD 管理器.這適用于創(chuàng)建具有特定硬件配置文件(我在 XML 文件中)的 AVD,但我發(fā)現(xiàn) AVD 經(jīng)常以某種方式中斷.AVD 旁邊是Repair".UI 中的選項(xiàng),并且我添加的硬件配置文件被刪除,導(dǎo)致我再次輸入它.這是痛苦和頻繁的,所以我想通過(guò)命令行自動(dòng)化它.
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"
之類的命令創(chuàng)建 AVD,但它會(huì)提示輸入自定義硬件,并且如果我選擇自定義硬件配置文件,它會(huì)提示我輸入每個(gè)單獨(dú)的屬性.這比使用 UI 更耗時(shí).
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.
此來(lái)源 聲稱android 工具允許您為虛擬設(shè)備設(shè)置硬件仿真選項(xiàng)",并提供了一個(gè)可以修改的屬性列表,但沒(méi)有說(shuō)明如何通過(guò)命令設(shè)置這些屬性.
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.
有沒(méi)有什么方法可以從命令行為 AVD 設(shè)置硬件配置文件,而無(wú)需手動(dòng)回答提示?
Is there some way to set the hardware profile for an AVD from the command line without manually answering prompts?
推薦答案
您能否嘗試修改 AVD 配置文件 config.ini 以獲得需要修改的所需 AVD.復(fù)制現(xiàn)有的 AVD,對(duì)硬件配置文件進(jìn)行必要的更改并將其用作基礎(chǔ)
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
這篇關(guān)于如何使用硬件配置文件從命令行創(chuàng)建 AVD?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!