name: android-test-emulator description: Launch or create the local Android emulator required before running Android connected/instrumented tests in this repository. Use this whenever running Android tests is required and no suitable device is already connected.
Android Test Emulator
Use this skill before running Android connected tests such as connectedAndroidTest or connectedDebugAndroidTest.
The required AVD name is Unstyled_Tests. If it does not exist, create it with:
- API level:
23 - System image:
system-images;android-23;default;x86_64, except Apple Silicon Macs usesystem-images;android-23;default;arm64-v8a - Display:
320x640 - Density:
160 dpi - CPU cores:
2 - Disk size:
2048M
Workflow
Check connected devices:
adb devicesIf a device is already connected and booted, use it.
Create the project emulator if it does not exist:
bash scripts/createAndroidEmulatorLaunch the project emulator:
bash scripts/launchAndroidEmulatorWait until boot is complete before running Android tests. The script waits for:
adb shell getprop sys.boot_completedAfter the emulator is ready, run the requested Android test task.
Notes
- Do not run Android tests until the emulator appears in
adb devicesasdeviceandsys.boot_completedis1. - If
emulatoris not onPATH, use$ANDROID_HOME/emulator/emulator,$ANDROID_SDK_ROOT/emulator/emulator, or$HOME/Library/Android/sdk/emulator/emulator. - The script uses the same runtime options expected for test execution:
-no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none.