aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-11-27 02:11:54 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-11-27 02:11:54 +0530
commit826483a0e13d527399accb15243d21dc0902d47e (patch)
tree0afa9865ba1422358b65a3afd0bdb286d8c16a42 /scripts
parent05253c127e0460022f049dbbb15cf3132469aab9 (diff)
scripts/boot-emulator: update for API 26 rework
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/boot-emulator.sh34
1 files changed, 19 insertions, 15 deletions
diff --git a/scripts/boot-emulator.sh b/scripts/boot-emulator.sh
index abd73efa..910340f1 100755
--- a/scripts/boot-emulator.sh
+++ b/scripts/boot-emulator.sh
@@ -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