Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulator failed to boot #324

Open
AndyTWF opened this issue Feb 20, 2023 · 27 comments
Open

Emulator failed to boot #324

AndyTWF opened this issue Feb 20, 2023 · 27 comments

Comments

@AndyTWF
Copy link

AndyTWF commented Feb 20, 2023

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! :)

@nihartsx
Copy link

Also running into the same since last 3 days.

@wadey1
Copy link

wadey1 commented Feb 24, 2023

+1 Also experiencing this for past 3 days. Seems to fail 70-80% of the time

@matt-ramotar
Copy link

Hey friends we are hitting this as well with Store

@Waltari10
Copy link

Same here. Running on 4-core latest ubuntu and it maybe starts 15% of time.

@mikus
Copy link

mikus commented Mar 1, 2023

Same story, timeout in most cases:

776 /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
777 /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
Terminate Emulator
778 /usr/local/lib/android/sdk/platform-tools/adb -s emulator-5554 emu kill
779 INFO    | Wait for emulator (pid 2385) 20 seconds to shutdown gracefully before kill;you can set environment variable ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL(in seconds) to change the default value (20 seconds)
780 OK: killing emulator, bye bye
781 OK
782 Error: Timeout waiting for emulator to boot.

@ipopov-belkacar
Copy link

API 29 with default config is working, but with API 30 I'm facing the same

782 Error: Timeout waiting for emulator to boot.

@josiasvfigueredo1985
Copy link

API 29 with default config is working, but with API 30 I'm facing the same

782 Error: Timeout waiting for emulator to boot.

I´m facing the same problem with that API, was everything fine until 2 day ago, and now that

@p709723778
Copy link

I have the same problem bytedance/flutter_ume#107

@matheusPereiraG
Copy link

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 :)

@accounts01
Copy link

Same here for me. Has anyone made any headway?

@nihartsx
Copy link

has been happening for almost two months now. Are there any other alternate options that anyone is using with Github actions?

@accounts01
Copy link

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.

@mariushorvat
Copy link

I have the same issues with API 31. I will give it a try with API 33.
FWIW: API 29 is not accepted in the Play Store anymore.

@cirion
Copy link

cirion commented Apr 26, 2023

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 an avd-name, and now the emulator consistently boots and runs the tests.

Our current working action is:

- name: Run UI Tests
  uses: reactivecircus/android-emulator-runner@v2
  with:
    api-level: 31
    profile: Nexus 6
    arch: arm64-v8a
    force-avd-creation: false
    avd-name: macOS-avd-arm64-v8a-31
    emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
    disable-animations: true
    script: ./gradlew connectedCheck

@jfoliveiraramos
Copy link

Having the same issue here

@ghost
Copy link

ghost commented Oct 17, 2023

Having the same issue on the "BuildJet" runner (buildjet-4vcpu-ubuntu-2204) with the following options:

        uses: ReactiveCircus/android-emulator-runner@v2.28.0
        with:
          api-level: 31
          target: google_apis
          arch: x86_64
          profile: pixel_6
          ram-size: 4096M
          heap-size: 512M
          avd-name: pixel6_API31
          force-avd-creation: true
          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          disable-animations: false
          script: ./integration_test/script.sh

@ghost
Copy link

ghost commented Oct 18, 2023

And the same with this:

        uses: ReactiveCircus/android-emulator-runner@v2.28.0
        with:
          api-level: 30
          target: google_atd
          arch: x86
          profile: pixel_6
          avd-name: pixel6_API30
          channel: canary
          script: ./integration_test/script.sh

@JonasVautherin
Copy link

I am seeing a similar issue on API 29 and 33 (haven't tried any other), but in my case adb seems to get online after a while. For some reason adb shell getprop sys.boot_completed doesn't seem to return whatever the action is expecting (testing locally, my emulator returns 1) and it loops seemingly forever.

  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  adb: device offline
  The process '/usr/local/lib/android/sdk/platform-tools/adb' failed with exit code 1
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  adb: device offline
  The process '/usr/local/lib/android/sdk/platform-tools/adb' failed with exit code 1
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  adb: device offline
  The process '/usr/local/lib/android/sdk/platform-tools/adb' failed with exit code 1
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed

@phamquoctrongnta
Copy link

Same issue:

WARNING | Failed to process .ini file /home/runner/.android/emu-update-last-check.ini for reading.
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  * daemon not running; starting now at tcp:5037
  * daemon started successfully
  adb: device offline
  The process '/usr/local/lib/android/sdk/platform-tools/adb' failed with exit code 1
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  1
  Emulator booted.
  /usr/local/lib/android/sdk/platform-tools/adb shell input keyevent 82
  Disabling animations.
  /usr/local/lib/android/sdk/platform-tools/adb shell settings put global window_animation_scale 0.0
  /usr/local/lib/android/sdk/platform-tools/adb shell settings put global transition_animation_scale 0.0
  /usr/local/lib/android/sdk/platform-tools/adb shell settings put global animator_duration_scale 0.0
/usr/bin/sh -c echo "Generated AVD snapshot for caching."

My YML:

name: Run test
on: push
jobs:
  build:
    name: Run integration test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4.1.1
      - name: Java setup
        uses: actions/setup-java@v4.0.0
        with:
          java-version: '17'
          distribution: 'zulu'
      - name: Flutter setup
        uses: subosito/flutter-action@v2.12.0
        with:
          channel: 'stable'
      - name: Enable KVM group perms
        run: |
          echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
          sudo udevadm control --reload-rules
          sudo udevadm trigger --name-match=kvm
      - name: Run Android emulator
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 29
          script: echo "Generated AVD snapshot for caching."
      - run: flutter doctor -v
      - run: flutter pub get
      - run: flutter pub run build_runner build --delete-conflicting-outputs
      - run: flutter test integration_test
      - run: flutter test

@Azzeccagarbugli
Copy link

Same issue:

WARNING | Failed to process .ini file /home/runner/.android/emu-update-last-check.ini for reading.
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  * daemon not running; starting now at tcp:5037
  * daemon started successfully
  adb: device offline
  The process '/usr/local/lib/android/sdk/platform-tools/adb' failed with exit code 1
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  1
  Emulator booted.
  /usr/local/lib/android/sdk/platform-tools/adb shell input keyevent 82
  Disabling animations.
  /usr/local/lib/android/sdk/platform-tools/adb shell settings put global window_animation_scale 0.0
  /usr/local/lib/android/sdk/platform-tools/adb shell settings put global transition_animation_scale 0.0
  /usr/local/lib/android/sdk/platform-tools/adb shell settings put global animator_duration_scale 0.0
/usr/bin/sh -c echo "Generated AVD snapshot for caching."

My YML:

name: Run test
on: push
jobs:
  build:
    name: Run integration test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4.1.1
      - name: Java setup
        uses: actions/setup-java@v4.0.0
        with:
          java-version: '17'
          distribution: 'zulu'
      - name: Flutter setup
        uses: subosito/flutter-action@v2.12.0
        with:
          channel: 'stable'
      - name: Enable KVM group perms
        run: |
          echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
          sudo udevadm control --reload-rules
          sudo udevadm trigger --name-match=kvm
      - name: Run Android emulator
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 29
          script: echo "Generated AVD snapshot for caching."
      - run: flutter doctor -v
      - run: flutter pub get
      - run: flutter pub run build_runner build --delete-conflicting-outputs
      - run: flutter test integration_test
      - run: flutter test

Unfortunately, I'm facing exactly the same issue

@lihenggui
Copy link

lihenggui commented Feb 5, 2024

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

@Napster134
Copy link

Napster134 commented Mar 15, 2024

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.

@hb0
Copy link

hb0 commented Mar 20, 2024

After adding the free-disk-space step

  • we also had to switch from the mac image (faster) to ubuntu-latest
    as free-disk-space action does not support the mac image:
    sudo: swapoff: command not found [...] free: command not found

  • After 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!

@santhoshshetty
Copy link

santhoshshetty commented Jun 1, 2024

Hello Dear Community,

Do we have a fix for this issue? I am still running into the problem with the error message below. Can someone please suggest a fix?

Error message:
The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed
adb: no devices/emulators found

Workflow:

name: Android Mobile CI - MAC OS
on:
  workflow_dispatch

jobs:
  build:

    runs-on: macos-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '21'  # Use a version compatible with ARM64
          check-latest: true

      - name: Run Android Tests
        uses: reactivecircus/android-emulator-runner@v2.19.1
        with:
          api-level: 31
          profile: Nexus 6
          arch: arm64-v8a
          force-avd-creation: false
          avd-name: macOS-avd-arm64-v8a-31
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          disable-animations: true
          script: |
            mvn clean test

Sample workflow - https://github.com/santhoshshetty/MobileAutomation/actions/runs/9391653932/job/25864291597

Any help or suggestions would be greatly appreciated. Thank you!

@santhoshshetty
Copy link

@ychescale9
I am sorry for bothering you by tagging you, but due to the ticket being in an open state for a long time and multiple people facing this blocker, I have been facing this issue for some time, and it is blocking progress on some important activities. Additionally, I see that this ticket has been open for a long time with the same error message reported during its creation. Could you please help us resolve this issue?

Thanks a lot, and I look forward to your response. Thank you once again.

@ychescale9
Copy link
Member

@santhoshshetty I looked at your sample workflow and looks like this is the issue:

PANIC: Avd's CPU Architecture 'x86' is not supported by the QEMU2 emulator on aarch64 host.

You're using macos-latest which currently points to macos-14 and the action currently doesn't work with arm64 runner. See:

Any reason you can't use ubuntu-latest?

@nehemiekoffi
Copy link

Hello here, it works with macos-13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests