Skip to content

Support for M1 Silicon - HVF error: HV_UNSUPPORTED #350

Open
@blumendorf

Description

@blumendorf

M1 Silicon is now supported by macOs runners on GitHub.

I tried to used android-emulator-runner on a setup using M1 and it does not seem to fire up the emulator.

The relevant error message seems to be this:

HVF error: HV_UNSUPPORTED
qemu-system-aarch64-headless: failed to initialize HVF: Invalid argument

Below is the full output and the gituhub workflow we are using.

Output:

Run reactivecircus/android-emulator-runner@v2
  with:
    api-level: 31
    arch: arm64-v8a
    avd-name: Nexus_5X_API_31
    script: yarn detox test --configuration android.emu.release --headless --record-logs all
    target: default
    cores: [2](XXXXX#step:11:2)
    force-avd-creation: true
    emulator-boot-timeout: 600
    emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
    disable-animations: true
    disable-spellchecker: false
    disable-linux-hw-accel: auto
    enable-hw-keyboard: false
    channel: stable
  env:
    JAVA_HOME: /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.8-101/arm64/Contents/Home
    JAVA_HOME_17_ARM64: /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.8-101/arm64/Contents/Home
    ANDROID_HOME: /Users/runner/Library/Android/sdk
    ANDROID_SDK_ROOT: /Users/runner/Library/Android/sdk
Configure emulator
  API level: [3](XXXXX#step:11:3)1
  target: default
  CPU architecture: arm6[4](XXXXX#step:11:4)-v8a
  Hardware profile: 
  Cores: 2
  RAM size: 
  Heap size: 
  SD card path or size: 
  Disk size: 
  AVD name: Nexus_[5](XXXXX#step:11:5)X_API_31
  force avd creation: true
  Emulator boot timeout: [6](XXXXX#step:11:6)00
  emulator options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
  disable animations: true
  disable spellchecker: false
  disable Linux hardware acceleration: false
  enable hardware keyboard: false
  Channel: 0 (stable)
  Script:
  yarn detox test --configuration android.emu.release --headless --record-logs all
  Pre emulator launch script:
Install Android SDK
  /bin/sh -c \yes | sdkmanager --licenses > /dev/null
  Installing latest build tools, platform tools, and platform.
  /bin/sh -c \sdkmanager --install 'build-tools;33.0.2' platform-tools > /dev/null
  Installing latest emulator.
  /bin/sh -c \sdkmanager --install emulator --channel=0 > /dev/null
  Installing system images.
  /bin/sh -c \sdkmanager --install 'system-images;android-31;default;arm64-v8a' --channel=0 > /dev/null
Launch Emulator
  Creating AVD.
  /bin/sh -c \echo no | avdmanager create avd --force -n Nexus_5X_API_31 --abi 'default/arm64-v8a' --package 'system-images;android-31;default;arm64-v8a'
  Loading local repository...                                                     
  [=========                              ] 25% Loading local repository...       
  [=========                              ] 25% Fetch remote repository...        
  [=======================================] 100% Fetch remote repository...       
  sh to create a custom hardware profile? [no] [command]/bin/sh -c \printf 'hw.cpu.ncore=2
  ' >> /Users/runner/.android/avd/Nexus_5X_API_31.avd/config.ini
  Starting emulator.
  /bin/sh -c \/Users/runner/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_31 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim &
  INFO    | Android emulator version 32.1.15.0 (build_id 10696886) (CL:N/A)
  INFO    | Found systemPath /Users/runner/Library/Android/sdk/system-images/android-31/default/arm64-v8a/
  WARNING | Please update the emulator to one that supports the feature(s): Vulkan
  WARNING | /etc/localtime does not point to zoneinfo-compatible timezone name
  ERROR   | Unable to connect to adb daemon on port: 503[7](XXXXX#step:11:7)
  WARNING | cannot add library /Users/runner/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
  INFO    | Crashreporting disabled, not reporting crashes.
  INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
  INFO    | added library /Users/runner/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
  INFO    | Sending adb public key [QAAAAHksz6k3gigFetxeAZXd9/lPSSLbdH/UxNcGEyNqrUdqEB9+/tOcM2Ye1OJVV0tnqaYlI6OPgljAy2ENFyeAJLw45ylXrH2OoEzDL1osleobLYeaCgkMBW[8](XXXXX#step:11:8)/CnWKe4AAZbGLY3Tv58[9](XXXXX#step:11:9)SsMrqt/37eQhkWdAFjwSrVbThJ2cStQlPO5JKlNuLkvU1FcaxtDlDV4Xu94YMEItEpxDVx1YsXJK7DledoLGf1mGjGtJCjks0hZynps4/Wu5whWtKOzWiqRLJXeaYtq+o/tMMzm0dV+a5/wYxuM7WrRrIuWjy7WhUEhjdyK7KV63goz7x0CVQijDj078K6BuTvgLBo0YGbreieqKrSDob9s2kgylNPax8AxfrKzq8KOK0YkWU7Ugr4djJv1WsCkS1SG8UissgLQedOCnC2GQRsQvk9KRywZElheE4qEDSQDevhrThbQU8ASNrG7K0FHUwEGEpX+CyHF5BRFF6yRHaHAUhzwo1PcQMviKE43oVWK5vFuDwGNs7[10](XXXXX#step:11:10)2AaIMUAXvxOCXwe9XCUul0ciEORK7omLRkz5YOsDUhmpcssrSv8IMWWCEh7ha8KDccjIZjpjLadXYGmJfn3/SGMKhinTngGrsSdTDB6insS52+LoASsVyAEuL/0wFYePnBc5ar7nbLFkVMCayksqmhF+linfDeKE371dFWOC0DCTD/PwEAAQA= runner@unknown]
  HVF error: HV_UNSUPPORTED
  qemu-system-aarch64-headless: failed to initialize HVF: Invalid argument
  INFO    | Wait for emulator (pid 59397) [20](XXXXX#step:11: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)
  /Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed
  * daemon not running; starting now at tcp:50[37](XXXXX#step:11:38)
  * daemon started successfully
  adb: no devices/emulators found
  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
  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
  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
  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
  [this continues ...]

workflow:

[...]
run-e2e-android-m1:
    name: Run Android e2e Tests on M1
    runs-on: macos-latest-xlarge
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 18.x
          cache: "yarn"

      - name: Install Dependencies
        run: yarn install

      - name: Expo Prepare Build
        run: yarn prebuild --platform android

      - name: Setup Java
        uses: actions/setup-java@v3
        with:
          cache: gradle
          distribution: temurin
          java-version: 17

      - name: Setup Android SDK (needed for the build)
        uses: android-actions/setup-android@v3

      - name: Cache Build
        id: cache-detox-android-build
        uses: actions/cache@v3
        with:
          path: android/build
          key: ${{ runner.os }}-detox-android-build
          restore-keys: |
            ${{ runner.os }}-detox-android-build

      - name: Detox Build
        run: detox build -c android.emu.release

      - name: Get device name
        id: device
        run: node -e "console.log('AVD_NAME=' + require('./detox.config.js').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT

      - name: Detox Test
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 31
          arch: arm64-v8a
          avd-name: ${{ steps.device.outputs.AVD_NAME }}
          script: yarn detox test --configuration android.emu.release --headless --record-logs all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions