Timeout waiting for emulator to boot. caused by actions/cache@v3
Sometimes github CI has an issue to launch avd from cached instance. Timeout waiting for emulator to boot. I have to remove your github action step from my build as it is not reliable to smooth CI process as it should be. I also consider option the issue might be on my side due not correct configuration.
In case you would like to investigate this issue, here a link on commit and android.yaml file
name: Android CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
api-level: [29]
target: [default]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: checkout
uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Grant execute permission for gradle
run: chmod +x gradle
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Build with Gradle
run: gradle build
- name: Printing directory structure
run: pwd && ls
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 5
script: gradle connectedAndroidTest
- name: Zip build reports
id: zipBuildReports
if: always()
run: zip -r build-reports.zip app/build/reports
- name: Upload build reports
if: always() && steps.zipBuildReports.outcome == 'success'
uses: actions/upload-artifact@v2
with:
name: build-reports
path: build-reports.zip
retention-days: 3
Steps to reproduce:
- Add this config file
- Write some UI\Espresso tests and confirm it works locally
- Push to the remote github repo
Observed behavior:
CI starts, job ends with error Timeout waiting for emulator to boot.
Expected behavior: CI starts, job ends successfully
👋 @Gelassen, i think setup-java folks might help you here. This repo is for Github action actions/cache
@tiwarishub, thank you for follow-up. Could you please share your arguments this issue relates to setup-java action rather than actions/cache?
I am running into this same issue, and I'm also confused why you think the issues would be with setup-java
Thanks!
👋 , My apologies i was under impression this caching is for setup-java. But now i see this caching is one which is created with actions/cache. Unfortunately the attached logs has expired. If it will be of great help, if you can provide debug logs https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging (step and runner) .
So, the cache seems like it's being hit properly but the ~/.android/avd/avd-name.avd/ folder doesn't exist.
2022-10-21T21:11:50.3343410Z ERROR | Unknown AVD name [ui-test-emulator], use -list-avds to see valid list.
2022-10-21T21:11:50.3345990Z ERROR | HOME is defined but there is no file ui-test-emulator.ini in $HOME/.android/avd
2022-10-21T21:11:50.3348960Z ERROR | (Note: Directories are searched in the order $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/avd and $HOME/.android/avd)
2022-10-21T21:11:16.7792470Z ##[group]Run actions/cache@v3
2022-10-21T21:11:16.7793270Z with:
2022-10-21T21:11:16.7794040Z path: ~/.android/avd/*
~/.android/adb*
~/.android/debug.keystore
2022-10-21T21:11:16.7794750Z key: 30-api-macOS-runner-
2022-10-21T21:11:16.7795480Z env:
2022-10-21T21:11:16.7796020Z JAVA_TOOL_OPTIONS: -Xmx4g
2022-10-21T21:11:16.7796600Z SHOULD_RUN_SPECIFIC_TEST: true
2022-10-21T21:11:16.7797400Z SINGLE_TEST_TO_RUN: account.AccountTest#screenshotAccountPage
2022-10-21T21:11:16.7798220Z API_LEVEL: 30
2022-10-21T21:11:16.7798900Z GITHUB_WORKSPACE: /Users/runner/work/*****-android-app/*****-android-app
2022-10-21T21:11:16.7799770Z GITHUB_RUN_NUMBER: 633
2022-10-21T21:11:16.7800340Z HOMEBREW_NO_INSTALL_CLEANUP: 1
2022-10-21T21:11:16.7800960Z GRADLE_BUILD_ACTION_SETUP_COMPLETED: true
2022-10-21T21:11:16.7801530Z GRADLE_BUILD_ACTION_CACHE_RESTORED: true
2022-10-21T21:11:16.7802420Z JAVA_HOME: /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.16-101/x64/Contents/Home
2022-10-21T21:11:16.7803300Z JAVA_HOME_11_X64: /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.16-101/x64/Contents/Home
2022-10-21T21:11:16.7804320Z ANDROID_HOME: /Users/runner/Library/Android/sdk
2022-10-21T21:11:16.7804930Z ANDROID_SDK_ROOT: /Users/runner/Library/Android/sdk
2022-10-21T21:11:16.7806020Z ##[endgroup]
2022-10-21T21:11:18.3336170Z Received 67108864 of 312491967 (21.5%), 63.9 MBs/sec
2022-10-21T21:11:19.3341960Z Received 188743680 of 312491967 (60.4%), 89.9 MBs/sec
2022-10-21T21:11:20.3342460Z Received 304103359 of 312491967 (97.3%), 96.6 MBs/sec
2022-10-21T21:11:20.9847310Z Received 312491967 of 312491967 (100.0%), 81.6 MBs/sec
2022-10-21T21:11:21.0061730Z Cache Size: ~298 MB (312491967 B)
2022-10-21T21:11:21.0126550Z [command]/usr/local/bin/gtar --use-compress-program unzstd -xf /Users/runner/work/_temp/0bb54a86-01ca-4bcd-888d-0ad303eb8c96/cache.tzst -P -C /Users/runner/work/*****-android-app/*****-android-app --delay-directory-restore
2022-10-21T21:11:43.6856970Z Cache restored successfully
2022-10-21T21:11:43.7145400Z Cache restored from key: 30-api-macOS-runner-
Regardless, I think it's some weird interaction with either android-emulator-runner or the way VMs are spun up by GHA.
I am going to add more logging around the $HOME variable and these other paths $ANDROID_AVD_HOME $ANDROID_SDK_HOME/avd and $HOME/.android/avd) at different points in the pipeline
This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.
This issue was closed because it has been inactive for 5 days since being marked as stale.