android-emulator-runner: Emulator failed to boot
When running the emulator on GitHub Actions (macos-latest), we occasionally get an error of Timeout waiting for emulator to boot. This is probably around 25-30% of test runs that we get this. I did a dive into the differences between a successful build and this error in terms of logs, but couldn’t spot anything obvious.
The build logs are as follows:
2023-02-16T21:02:48.9274480Z ##[group]Launch Emulator
2023-02-16T21:02:48.9355520Z Creating AVD.
2023-02-16T21:02:48.9371150Z [command]/bin/sh -c \echo no | avdmanager create avd --force -n test --abi 'default/x86' --package 'system-images;android-24;default;x86'
2023-02-16T21:02:51.4707730Z Loading local repository...
2023-02-16T21:02:51.4746140Z [========= ] 25% Loading local repository...
2023-02-16T21:02:51.4747010Z [========= ] 25% Fetch remote repository...
2023-02-16T21:02:51.4747400Z [=======================================] 100% Fetch remote repository...
2023-02-16T21:02:52.3224520Z Do you wish to create a custom hardware profile? [no] [command]/bin/sh -c \printf 'hw.cpu.ncore=2
2023-02-16T21:02:52.3225790Z ' >> /Users/runner/.android/avd/test.avd/config.ini
2023-02-16T21:02:52.3298780Z Starting emulator.
2023-02-16T21:02:52.3328190Z [command]/bin/sh -c \/Users/runner/Library/Android/sdk/emulator/emulator -avd test -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim &
2023-02-16T21:02:53.0896040Z INFO | Android emulator version 32.1.11.0 (build_id 9536276) (CL:N/A)
2023-02-16T21:02:53.1265250Z INFO | Found systemPath /Users/runner/Library/Android/sdk/system-images/android-24/default/x86/
2023-02-16T21:02:53.1366860Z INFO | Found systemPath /Users/runner/Library/Android/sdk/system-images/android-24/default/x86/
2023-02-16T21:02:56.3485370Z WARNING | encryption is off
2023-02-16T21:02:56.3600450Z WARNING | Running on a system with less than 6 logical cores. Setting number of virtual cores to 1
2023-02-16T21:02:57.1046830Z ERROR | Unable to connect to adb daemon on port: 5037
2023-02-16T21:02:58.0422260Z WARNING | cannot add library /Users/runner/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
2023-02-16T21:02:58.0520210Z INFO | Crashreporting disabled, not reporting crashes.
2023-02-16T21:02:58.0622110Z INFO | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
2023-02-16T21:02:58.1968680Z WARNING | /etc/localtime does not point to zoneinfo-compatible timezone name
2023-02-16T21:02:58.2072600Z WARNING | *** No gRPC protection active, consider launching with the -grpc-use-jwt flag.***
2023-02-16T21:02:58.2421060Z [command]/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed
2023-02-16T21:02:58.2641090Z * daemon not running; starting now at tcp:5037
2023-02-16T21:02:58.7321700Z * daemon started successfully
2023-02-16T21:02:58.7334000Z adb: no devices/emulators found
2023-02-16T21:02:58.7349340Z The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
2023-02-16T21:03:00.7425490Z [command]/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed
2023-02-16T21:03:00.7634680Z adb: no devices/emulators found
2023-02-16T21:03:00.7650360Z The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
2023-02-16T21:03:02.7681960Z [command]/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed
2023-02-16T21:03:02.7908520Z adb: no devices/emulators found
---- Repeat many times ----
/Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 emu kill
error: could not connect to TCP port 5554: Connection refused
The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
Our workflow file can be found at: https://github.com/ably/ably-asset-tracking-android/blob/main/.github/workflows/emulate.yml
Thanks! 😃
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 19
- Comments: 23
Commits related to this issue
- chore: free disk space https://github.com/ReactiveCircus/android-emulator-runner/issues/324 — committed to lydavid/MusicSearch by lydavid 3 months ago
Same story, timeout in most cases:
I am seeing a similar issue on API 29 and 33 (haven’t tried any other), but in my case
adbseems to get online after a while. For some reasonadb shell getprop sys.boot_completeddoesn’t seem to return whatever the action is expecting (testing locally, my emulator returns1) and it loops seemingly forever.After adding the free-disk-space step
we also had to switch from the
macimage (faster) toubuntu-latestas free-disk-space action does not support themacimage:sudo: swapoff: command not found [...] free: command not foundAfter switching to
ubuntu-latest, the emulator still does not start:Error: Timeout waiting for emulator to boot.So we also added the KVM step from nowinandroid which also didn’t fix it.
We finally also borrowed the other configurations from notinandroid which finally fixed the emulator startup!
Having the same issue here
Happened in the Android official example project:
Log: https://github.com/android/nowinandroid/actions/runs/7781658194/job/21216491940?pr=1203 https://github.com/android/nowinandroid/actions/runs/7781859426/job/21217113346?pr=1204
+1 Also experiencing this for past 3 days. Seems to fail 70-80% of the time
I noticed that in the Android official example project, someone merged in this change with a git commit mentioning “to fix CI”
Another PR was linked in the above PR’s description where this relevant conversation was held.
After seeing this, I decided to implement the free-disk-space action within my workflow and it seems it may have resolved the emulator failing to boot. This is a recent change for my workflow so hopefully I’ll know after enough runs if it’s truly fixed or not.
Same issue:
My YML:
Just noting here that we were seeing the same error when using a self-hosted ARM64 runner (always fails with
adb: no devices/emulators found). After some digging, the root cause seemed to be the same as #239 . We started defining anavd-name, and now the emulator consistently boots and runs the tests.Our current working action is:
I ended up firing up a Firebase Test Lab test from my Github Action. It’s not as elegant as having everything running neatly in my own runner, but it’ll do for now.
It looks like the main workflow of this repo is also failing with the same problem we are all having 😕 Is there any more information on what the problem is and when it will probably be fixed? Thank you in advance 😃
Same here. Running on 4-core latest ubuntu and it maybe starts 15% of time.
Hey friends we are hitting this as well with Store
Also running into the same since last 3 days.