diff --git a/.github/scripts/write_entitlements.sh b/.github/scripts/write_entitlements.sh new file mode 100644 index 000000000..6b4ca680a --- /dev/null +++ b/.github/scripts/write_entitlements.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +# Modified from: +# https://stackoverflow.com/questions/67264212/android-emulator-crash-when-start-hvf-error-hv-error + +original_dir=$(pwd) +target_dir=~/Library/Android/sdk/emulator/qemu/darwin-aarch64 +file_path=entitlements.xml + +xml_content=' + + + + com.apple.security.hypervisor + + +' + +cd "$target_dir" +echo "$xml_content" > "$file_path" +codesign -s - --entitlements entitlements.xml --force ./qemu-system-aarch64 +cd "$original_dir" diff --git a/.github/workflows/e2e-android.yml b/.github/workflows/e2e-android.yml index 4a5b0d93f..dfab0c1f7 100644 --- a/.github/workflows/e2e-android.yml +++ b/.github/workflows/e2e-android.yml @@ -25,23 +25,26 @@ jobs: git lfs pull # see: https://stackoverflow.com/questions/67264212/android-emulator-crash-when-start-hvf-error-hv-error - - name: Create qemu entitlements - run: | - { - echo '' - echo '' - echo '' - echo '' - echo ' com.apple.security.hypervisor' - echo ' ' - echo '' - echo '' - } >> $ANDROID_HOME/emulator/qemu/darwin-aarch64/entitlements.xml - - - name: Re-sign qemu binary - run: | - cd $ANDROID_HOME/emulator/qemu/darwin-aarch64 - codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64 --verbose + # - name: Create qemu entitlements + # run: | + # { + # echo '' + # echo '' + # echo '' + # echo '' + # echo ' com.apple.security.hypervisor' + # echo ' ' + # echo '' + # echo '' + # } >> $ANDROID_HOME/emulator/qemu/darwin-aarch64/entitlements.xml + + # - name: Re-sign qemu binary + # run: | + # cd $ANDROID_HOME/emulator/qemu/darwin-aarch64 + # codesign -s - --entitlements entitlements.xml --force qemu-system-aarch64 --verbose + + - name: Write entitlements + run: ./scripts/write_entitlements.sh - name: Install SDK image run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install 'system-images;android-34;google_apis;arm64-v8a'