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.
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.
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.
Is there some way to set the hardware profile for an AVD from the command line without manually answering prompts?
You should be able to use the
--device
/-d
flag.First get a list of the available device definitions:
Then use the numeric or string ID when you create your AVD: