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
# Boots an emulator that exactly matches the one in our CI. It is recommended
# to use this as the target device for android tests.
# Creates and boots a display-less emulator (defaulting to Android 8.1, our min SDK)
set -euo pipefail
[ -n "${ANDROID_SDK_ROOT:-}" ] || {
echo "ANDROID_SDK_ROOT must be set to use this script"
exit
1
[ -n "${ANDROID_HOME:-}" ] || {
echo "ANDROID_HOME must be set to use this script"
exit 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 \
-n "Pixel_XL_API_${API_LEVEL}" \
--abi 'google_apis/x86' \
--package "system-images;android-${API_LEVEL};google_apis;x86" \
--abi "google_apis/${ARCH}" \
--package "system-images;android-${API_LEVEL};google_apis;${ARCH}" \
--device 'pixel_xl'
"${ANDROID_SDK_ROOT}"/emulator/emulator \
"${ANDROID_HOME}"/emulator/emulator \
-avd "Pixel_XL_API_${API_LEVEL}" \
-gpu 'swiftshader_indirect' \
-no-window \
-gpu swiftshader_indirect \
-noaudio \
-no-boot-anim
-noaudio