Device setup

testrelic device setup takes a bare machine to a booted Android emulator — no JDK, no Android Studio required — then device up boots it for WebDriver, Maestro, or adb.

testrelic device setup installs everything Android testing needs — platform tools, the emulator, a system image, the SDK licenses, and a ready-to-boot AVD — without a JDK or an Android Studio install. Packages come straight from dl.google.com; nothing is fetched through sdkmanager itself.

Re-run safe

device setup plans only the gaps: on a bare machine it installs everything, on a partial SDK it fills in what's missing, and running it again after a successful setup does nothing.

Usage

testrelic device setup                  # interactive — confirms the ~2 GB download and SDK license
testrelic device setup --yes             # non-interactive — required in CI/scripts
testrelic device setup --api 34          # pin the system image's Android API level (default: 34)
testrelic device setup --sdk-root ~/sdk  # install somewhere other than the detected/default SDK root
testrelic device setup --json            # stream NDJSON progress events, one per line

Once setup finishes, boot the device it created:

testrelic device up          # boots the TestRelic_Device AVD
testrelic device up --serve  # boot, then also serve WebDriver on :4723

device up returns only once the guest has finished booting. Other useful flags: --avd <name>, --headless (no emulator window), --fresh (wipe user data for a clean cold start), --cold-boot (skip the saved quick-boot snapshot but keep user data), --install <app.apk>, --capture-network (record the hosts, timings and volumes the device talks to, without intercepting traffic), --timeout <seconds> (default 300) and --json-progress (narrate the boot as NDJSON on stdout; an already-running AVD is reused).

testrelic device list shows AVDs and everything running, including USB phones with USB debugging on. testrelic device serve --capture records every WebDriver command with the device logs it caused, and testrelic device capture summarizes that session: command timings, error clusters and the hosts the app talked to. device down --all stops every running emulator and never touches physical devices.

What it installs

StepWhat happens
Platform toolsadb and friends.
EmulatorThe Android emulator binary.
System imageAndroid 14 (API 34) with Google APIs, by default — override with --api.
SDK licensesWritten the same way sdkmanager writes them, only after you consent.
Virtual deviceAn AVD named TestRelic_Device, hardened from field use: 4 GB RAM (2 GB causes ANR storms under an API-34 Google-APIs guest), hw.wifi=no (virtual Wi-Fi otherwise blinds --capture-network), 4 CPU cores, keyboard enabled.

Downloads land in ~/.testrelic/cache/android, keyed by filename — an interrupted run, a failed extract, or Studio retrying the flow never re-pays the ~1.5 GB fetch. The SDK installs into $ANDROID_HOME when it's set, or the same platform-default location Android Studio itself uses, so any later Android Studio install — or any other tool — finds it with no configuration.

Flags

FlagPurpose
--yesConsent non-interactively to the download and the Android SDK license. Required when stdin isn't a TTY (CI, scripts, Studio) — setup fails closed without it.
--sdk-root <path>Install into this SDK root instead of the detected or default one.
--api <level>Android API level for the system image. Defaults to 34.
--jsonStream one NDJSON SetupEvent per line on stdout, for a script or a UI to render live progress.

Diagnose before you provision

testrelic device doctor reports exactly what's missing — SDK location, adb/emulator/aapt2, hypervisor acceleration, and configured AVDs — before you run setup, and confirms what setup produced afterward.

In Studio

The Live Device pane doubles as the onboarding surface: it probes for a missing SDK, a missing AVD, or a ready device, and on a bare machine offers Install Android tooling (~2 GB). That streams device setup --json's events into a step checklist with one progress bar, then Boot device & serve WebDriver starts the emulator and streams its screen live — the same pane the Live Browser uses for a browser. See Live Device.

Next steps

→ Live Device · CLI overview

Was this page helpful?

On this page