Sign inSign up

s4l3h1/android-emulator-farm

By s4l3h1

•Updated 6 days ago

Headless Android emulators (API 24-36) in Docker for testing APKs and AABs over adb before release.

Image
0

1.1K

s4l3h1/android-emulator-farm repository overview

⁠android-emulator-farm

Headless Android emulators in Docker, one image per API level. Use them to install and test an APK or AAB on real Android system images before a build goes to production, on a laptop or a CI runner, without installing the Android SDK on the host.

  • One tag per Android API, from 24 (Android 7.0) to 36 (Android 16).
  • x86_64 system images with KVM acceleration. Images are linux/amd64.
  • adb is published on container port 5556.
  • The container reports healthy once Android has finished booting.

Source, issues, and build workflow: https://github.com/salehi/android-emulator-farm⁠

⁠Quick start

The host needs Docker and /dev/kvm.

docker run -d --name android-36 \
  --device /dev/kvm --shm-size 2g \
  -p 127.0.0.1:5036:5556 \
  s4l3h1/android-emulator-farm:api36

# Wait for "boot completed" (or for the container to become healthy).
docker logs -f android-36

adb connect 127.0.0.1:5036
adb -s 127.0.0.1:5036 install -r app.apk

For an AAB, build an APK set with bundletool and install it:

bundletool build-apks --bundle=app.aab --output=app.apks --connected-device
bundletool install-apks --apks=app.apks --device-id=127.0.0.1:5036

⁠Compose

services:
  android-34:
    image: s4l3h1/android-emulator-farm:api34
    devices:
      - /dev/kvm:/dev/kvm
    shm_size: "2gb"
    ports:
      - "127.0.0.1:5034:5556"

The source repository has a ready-made docker-compose.yml with one service per API.

⁠Tags

api<API>-<git sha> is also pushed for every build and never moves. latest follows the newest API. The suggested host port is 5000+API.

APIAndroidSystem imageTagsHost adb
247.0google_apisapi24, 24, android-7.0, api24-google_apis127.0.0.1:5024
257.1google_apisapi25, 25, android-7.1, api25-google_apis127.0.0.1:5025
268.0google_apisapi26, 26, android-8.0, api26-google_apis127.0.0.1:5026
278.1defaultapi27, 27, android-8.1, api27-default127.0.0.1:5027
289google_apisapi28, 28, android-9, api28-google_apis127.0.0.1:5028
2910google_apisapi29, 29, android-10, api29-google_apis127.0.0.1:5029
3011google_apisapi30, 30, android-11, api30-google_apis127.0.0.1:5030
3112google_apisapi31, 31, android-12, api31-google_apis127.0.0.1:5031
3212.1google_apisapi32, 32, android-12.1, api32-google_apis127.0.0.1:5032
3313google_apisapi33, 33, android-13, api33-google_apis127.0.0.1:5033
3414google_apisapi34, 34, android-14, api34-google_apis127.0.0.1:5034
3515google_apisapi35, 35, android-15, api35-google_apis127.0.0.1:5035
3616google_apisapi36, 36, android-16, api36-google_apis, latest127.0.0.1:5036

⁠Configuration

VariableDefaultMeaning
BOOT_TIMEOUT600Seconds to wait for Android to finish booting.
EMULATOR_MEMORY1536Guest RAM in MB.
EMULATOR_CORES2Guest CPU cores.
EMULATOR_GPUswiftshader_indirectEmulator -gpu mode.
EMULATOR_ARGSExtra emulator flags, split on whitespace.

Each emulator needs about 2 GB of host RAM.

Tag summary

Content type

Image

Digest

sha256:04a9e4cad…

Size

2.5 GB

Last updated

6 days ago

docker pull s4l3h1/android-emulator-farm