ReactiveCircus / android-emulator-runner

A GitHub Action for installing, configuring and running hardware-accelerated Android Emulators on macOS virtual machines.
Apache License 2.0
977 stars 193 forks source link

Emulator fails to start with `arch: arm64-v8a` + `target: google_apis` running API 34 #392

Open jaredsburrows opened 6 months ago

jaredsburrows commented 6 months ago

Linked to github actions: https://github.com/jaredsburrows/android-gif-search/actions/runs/8861878177/job/24334841889

Setup:

      - 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: Create AVD and generate snapshot for caching
        if: steps.avd-cache.outputs.cache-hit != 'true'
        uses: reactivecircus/android-emulator-runner@v2.30.1
        with:
          api-level: ${{ env.ANDROID_API_LEVEL }}
          arch: x86_64
          target: google_apis
          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: Run Debug Instrumentation Tests on Android API ${{ matrix.api-level }} (Ran up to 2 times)
        uses: reactivecircus/android-emulator-runner@v2.30.1
        with:
          api-level: ${{ env.ANDROID_API_LEVEL }}
          arch: x86_64
          target: google_apis
          force-avd-creation: false
          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save
          disable-animations: true
          script: ./gradlew connectedDebugAndroidTest -s || ./gradlew connectedDebugAndroidTest -s

Emulator never starts:

Run reactivecircus/android-emulator-runner@v2.30.1
  with:
    api-level: 34
    arch: arm64-v8a
    target: google_apis
    force-avd-creation: false
    emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
    disable-animations: true
    script: ./gradlew connectedDebugAndroidTest -s || ./gradlew connectedDebugAndroidTest -s
    cores: [2](https://github.com/jaredsburrows/android-gif-search/actions/runs/8861878177/job/24334841889#step:16:2)
    avd-name: test
    emulator-boot-timeout: 600
    disable-spellchecker: false
    disable-linux-hw-accel: auto
    enable-hw-keyboard: false
    channel: stable
  env:
    GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false
    JAVA_VERSION: 20
    ANDROID_API_LEVEL: [3](https://github.com/jaredsburrows/android-gif-search/actions/runs/8861878177/job/24334841889#step:16:3)4
    GRADLE_ACTION_ID: gradle/actions/setup-gradle
    JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/20.0.2-9/x6[4](https://github.com/jaredsburrows/android-gif-search/actions/runs/8861878177/job/24334841889#step:16:4)
    JAVA_HOME_20_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/20.0.2-9/x64
    GRADLE_BUILD_ACTION_SETUP_COMPLETED: true
    GRADLE_BUILD_ACTION_CACHE_RESTORED: true
    DEVELOCITY_INJECTION_INIT_SCRIPT_NAME: gradle-actions.inject-develocity.init.gradle
    DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE: gradle-actions
    GITHUB_DEPENDENCY_GRAPH_ENABLED: false
Configure emulator
  API level: 34
  target: google_apis
  CPU architecture: arm64-v8a
  Hardware profile: 
  Cores: 2
  RAM size: 
  Heap size: 
  SD card path or size: 
  Disk size: 
  AVD name: test
  force avd creation: false
  Emulator boot timeout: 600
  emulator options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
  disable animations: true
  disable spellchecker: false
  disable Linux hardware acceleration: false
  enable hardware keyboard: false
  Channel: 0 (stable)
  Script:
  ./gradlew connectedDebugAndroidTest -s || ./gradlew connectedDebugAndroidTest -s
  Pre emulator launch script:
Install Android SDK
  /usr/bin/sh -c \sudo chown $USER:$USER /usr/local/lib/android/sdk -R
  /usr/bin/sh -c \yes | sdkmanager --licenses > /dev/null
  Warning: Errors during XML parse:
  Warning: Additionally, the fallback loader failed to parse the XML.
  Installing latest build tools, platform tools, and platform.
  /usr/bin/sh -c \sdkmanager --install 'build-tools;34.0.0' platform-tools > /dev/null
  Warning: Errors during XML parse:
  Warning: Additionally, the fallback loader failed to parse the XML.
  Installing latest emulator.
  /usr/bin/sh -c \sdkmanager --install emulator --channel=0 > /dev/null
  Warning: Errors during XML parse:
  Warning: Additionally, the fallback loader failed to parse the XML.
  Installing system images.
  /usr/bin/sh -c \sdkmanager --install 'system-images;android-34;google_apis;arm64-v8a' --channel=0 > /dev/null
  Warning: Errors during XML parse:
  Warning: Additionally, the fallback loader failed to parse the XML.
Launch Emulator
  /usr/bin/sh -c \printf 'hw.cpu.ncore=2
  ' >> /home/runner/.android/avd/test.avd/config.ini
  Starting emulator.
  /usr/bin/sh -c \/usr/local/lib/android/sdk/emulator/emulator -avd test -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none &
  WARNING | /usr/local/lib/android/sdk/system-images/android-34/google_apis/x86_64/ is not a valid directory.
  WARNING | emulator has searched the above paths but found no valid sdk root directory.
  PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/usr/local/lib/android/sdk]!
  INFO    | Storing crashdata in: /tmp/android-runner/emu-crash-34.1.20.db, detection is enabled for process: 4181
  INFO    | Android emulator version 34.1.20.0 (build_id 11610631) (CL:N/A)
  INFO    | AVD test has path /home/runner/.android/avd/../avd/test.avd
  INFO    | trying to check whether /usr/local/lib/android/sdk is a valid sdk root
  /usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
  * daemon not running; starting now at tcp:[5](https://github.com/jaredsburrows/android-gif-search/actions/runs/8861878177/job/24334841889#step:16:5)037
  * daemon started successfully
  adb: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  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: no devices/emulators found
  The process '/usr/local/lib/android/sdk/platform-tools/adb' failed with exit code 1
finagolfin commented 6 months ago

It can't find the google image for the emulator to run:

  WARNING | /usr/local/lib/android/sdk/system-images/android-34/google_apis/x86_64/ is not a valid directory.
  WARNING | emulator has searched the above paths but found no valid sdk root directory.
  PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/usr/local/lib/android/sdk]!
aldochristiaan commented 6 months ago

Is there any update for this issue ?

RyanCarrier commented 6 months ago

If you turn off avd caching should work ok

kaanx022 commented 6 months ago

anyone know why on macos-latest NONE of the images are working, below I'm running all possible combinations in a github actions matrix

?????

https://github.com/kaanx022/kaan/actions/runs/9042903322

ridiculous

aldochristiaan commented 6 months ago

GitHub Action updated macos-latest to macos-14 and its using m1 chip, sadly its not working .. You can try to use macos-13 , it works fine .. @kaanx022

alex-lechner commented 5 months ago

I'm using a Mac Mini with M2 chip as a self-hosted runner and have the same problem. Any workaround?

EranBoudjnah commented 2 months ago

Since this doesn't seem like it's going to be fixed, are there any alternatives?

RyanCarrier commented 2 days ago

I'm using a Mac Mini with M2 chip as a self-hosted runner and have the same problem. Any workaround?

M2 Doesn't support nested virtualisation :(

Assuming your runner is in a vm and not bare metal it won't work