scripts/boot-emulator: update for API 26 rework

This commit is contained in:
Harsh Shandilya 2023-11-27 02:11:54 +05:30
parent 05253c127e
commit 826483a0e1
No known key found for this signature in database

View file

@ -1,29 +1,33 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Boots an emulator that exactly matches the one in our CI. It is recommended # Creates and boots a display-less emulator (defaulting to Android 8.1, our min SDK)
# to use this as the target device for android tests.
set -euo pipefail set -euo pipefail
[ -n "${ANDROID_SDK_ROOT:-}" ] || { [ -n "${ANDROID_HOME:-}" ] || {
echo "ANDROID_SDK_ROOT must be set to use this script" echo "ANDROID_HOME must be set to use this script"
exit exit 1
1
} }
[ -n "${ANDROID_API_LEVEL:-}" ] || { echo "ANDROID_API_LEVEL not defined; defaulting to 30"; }
API_LEVEL="${ANDROID_API_LEVEL:-30}" [ -n "${ANDROID_API_LEVEL:-}" ] || { echo "ANDROID_API_LEVEL not defined; defaulting to 26"; }
API_LEVEL="${ANDROID_API_LEVEL:-26}"
echo no | "${ANDROID_SDK_ROOT}"/cmdline-tools/latest/bin/avdmanager create avd \ ARCH="x86_64"
if [[ "$(uname -m)" == "arm64" && "$(uname)" == "Darwin" ]]; then
ARCH="arm64-v8a"
fi
sdkmanager "system-images;android-${API_LEVEL};google_apis;${ARCH}"
echo no | "${ANDROID_HOME}"/cmdline-tools/latest/bin/avdmanager create avd \
--force \ --force \
-n "Pixel_XL_API_${API_LEVEL}" \ -n "Pixel_XL_API_${API_LEVEL}" \
--abi 'google_apis/x86' \ --abi "google_apis/${ARCH}" \
--package "system-images;android-${API_LEVEL};google_apis;x86" \ --package "system-images;android-${API_LEVEL};google_apis;${ARCH}" \
--device 'pixel_xl' --device 'pixel_xl'
"${ANDROID_SDK_ROOT}"/emulator/emulator \ "${ANDROID_HOME}"/emulator/emulator \
-avd "Pixel_XL_API_${API_LEVEL}" \ -avd "Pixel_XL_API_${API_LEVEL}" \
-gpu 'swiftshader_indirect' \
-no-window \ -no-window \
-gpu swiftshader_indirect \ -noaudio
-noaudio \
-no-boot-anim