Prerequisites
Before setting up Android Virtual Devices, ensure:- MacStadium VDI is deployed and operational (see the Deployment Guide)
- Ansible runner has
sshpassinstalled - The target macOS VM is running on a host node where the Android SDK will be installed
Install the Android SDK
Run this on the Ansible runner to install the Android SDK on your host nodes. This installs:- Homebrew (if not already present)
- Eclipse Temurin JDK 21
- Android command-line tools, platform-tools, and emulator packages
socat(used to set up the ADB relay between the host and your VM)- A
run-avdscript at/opt/orka/bin/run-avd
JAVA_HOME, ANDROID_HOME, and PATH in the host’s .zshrc.
Install SDK Platforms and System Images
Once the Android SDK is installed, install the platform and system images you want to use for your AVDs.android-35 with default and google_apis system images by default. To specify a different platform or image types:
platform— Android platform to install (default:android-35)image_types— comma-separated list of system image types (default:default,google_apis)
Create an Android Virtual Device
AVDs are tied to a specific VM. The AVD name is derived automatically from the VM name using the pattern{vm_name}-avd-{index}, where the index increments for each additional AVD on that VM (e.g. my-vm-avd-0, my-vm-avd-1).
Run with --tags plan first to preview which host the AVD will be created on:
vm_name(required) — name of the running VM the AVD should be associated withplatform— Android platform to use (default:android-35)image_type— system image type (default:default)run_avd— whether to start the AVD immediately after creation (default:true)cpu— vCPUs to allocate to the AVDmemory— memory in MB to allocate to the AVD
Manage Android Virtual Devices
Start, stop, or delete an AVD
Useavd.yml to bring an AVD to a desired state. The playbook is idempotent - it will not attempt to start an already running AVD, stop an already stopped one, or delete one that does not exist.
desired_state: running, stopped, absent
When only one AVD exists for a VM, it is selected automatically. If multiple AVDs exist, specify which one using avd_index:
List AVDs
To list all AVDs across all hosts:Delete an AVD
To delete a specific AVD by index:vm_name— name of the VM the AVD is associated withavd_index— index of the AVD to delete (e.g.0formy-vm-avd-0)
Uninstall SDK Platforms and System Images
To uninstall a specific platform and all of its system images from host nodes:android-35 by default. To target a different platform:

