Run Android Tests on Real Phones in GitHub Actions
Description and use
A GitHub Actions workflow that connects to a real Android device, installs the APK, runs instrumented tests, and disconnects cleanly, ensuring reliable hardware‑specific testing.
Problem
CI pipelines using emulators fail to detect hardware‑specific issues, leading to green builds that miss real‑device bugs.
Outcome
The workflow reliably runs Android tests on real devices, handling flaky connections, ensuring clean device state, and preventing test collisions via concurrency groups.
Workflow
- Checkout repository
- Set up Android SDK and platform‑tools
- Build debug APK
- Connect to device with retry loop
- Install APK on device
- Run instrumented tests
- Disconnect device (always)
Evidence
Emulators in CI are fine until your app cares about being on a real device.
The loop in the first block handles that: connect, wait, check that the state is device, and only then move on.
A concurrency group makes device jobs queue instead of colliding.
- Record date: 2026-10-06T09:55:56.412Z