## TL;DR

Run emulators headless in CI with hardware acceleration, keep one emulator per job, and accept that mobile e2e is slower: split it from the fast suite.

## Error

```text
(Not an error; a setup guide. The challenge: emulators are heavy and slow in CI.)
```

## Steps

1. Use a CI image with the Android SDK or Xcode preinstalled. Expected: no SDK downloads per run.
2. Create the emulator once: `avdmanager create avd` with an x86_64 image. Expected: a defined device.
3. Boot headless with `-no-window -no-audio` and wait for `sys.boot_completed`. Expected: deterministic boot.
4. Enable hardware acceleration (KVM on Linux runners). Expected: usable speed.
5. Run the mobile suite as its own job, possibly nightly. Expected: does not block every PR.

## When to use

- Adding Appium/Detox/Espresso/XCUITest to CI.
- You need real-device-ish fidelity.

## When not to use

- Unit tests (run on the JVM/Node directly).
- Every-PR gating (too slow; use nightly).

## Tool compatibility

- Android emulator, iOS simulator; Appium, Detox, Espresso, XCUITest.

## Variant phrasings

### Android emulator in CI

The Android-specific setup.

### iOS simulator GitHub Actions

The iOS-specific setup; macOS runners required.

## Why it happens

Mobile tests need a device. Emulators provide it, but they are resource-hungry and slow to boot.

## Edge cases

- macOS runners are required for iOS simulators and cost more.
- Emulator snapshots speed up boot dramatically; use them.
- Flakiness is higher on emulators; budget retries.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_TJohTtHmPSxuvz8Bg72TRg
