# Android Emulator (https://tenki.cloud/docs/runners/android-emulator)

> For the complete documentation index, see [llms.txt](https://tenki.cloud/llms.txt)

Run Android emulator UI tests on Tenki Linux x64 Runners with nested virtualization (KVM) enabled.



Tenki Linux x64 Runners support **KVM nested virtualization**, so they can run Android emulator-based CI, Espresso, instrumented tests, screenshot tests, Detox, and similar UI-test workloads.

Nested virtualization (KVM) [#nested-virtualization-kvm]

KVM is **available on request** for x64 runners. Once enabled on your workspace, your jobs can boot Android emulators using the standard Android SDK system images, including:

* `system-images;android-34;google_apis;x86_64`
* Older API levels (29 to 33) for legacy test matrices
* Google Play variants of the above

End-to-end UI tests (Espresso, instrumented JUnit, screenshot tests) run on the booted emulator within the runner.

> **Enable nested virtualization:** Email hello@tenki.cloud to enable KVM on your workspace. We'll confirm enablement within one business day.

Example workflow [#example-workflow]

The workflow below uses [`reactivecircus/android-emulator-runner`](https://github.com/ReactiveCircus/android-emulator-runner) on a Tenki Linux runner. The only line that differs from a GitHub-hosted runner workflow is `runs-on`.

```yaml
jobs:
  ui-tests:
    runs-on: tenki-standard-large-8c-16g
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: 17

      - name: Cache AVD
        uses: actions/cache@v4
        with:
          path: |
            ~/.android/avd/*
            ~/.android/adb*
          key: avd-android-34

      - name: Run instrumented tests
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 34
          target: google_apis
          arch: x86_64
          script: ./gradlew connectedCheck
```

Picking a runner size [#picking-a-runner-size]

Android emulator workloads are memory-hungry and benefit from more cores during APK compilation. Recommended starting points:

| Workload                        | Recommended runner                  |
| ------------------------------- | ----------------------------------- |
| Single emulator, smoke tests    | `tenki-standard-medium-4c-8g`       |
| Mixed instrumented + unit suite | `tenki-standard-large-8c-16g`       |
| Sharded UI test matrix          | `tenki-standard-large-plus-16c-32g` |

See [Which Runner to use?](/docs/runners/which-runner-should-i-use) for general sizing guidance.

Caching the emulator [#caching-the-emulator]

Use the Tenki cache (a drop-in replacement for `actions/cache`) to persist the AVD between runs. The first cold boot of a new API level takes a few minutes; subsequent runs with a warm AVD are much faster.
