From f79b13a6d10f4936c71d7d4772ed8d91894a24d5 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Fri, 1 Sep 2023 15:36:38 -0400 Subject: [PATCH] android fixes --- scripts/new_android_sim.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/scripts/new_android_sim.sh b/scripts/new_android_sim.sh index eac100d0..db2d877a 100755 --- a/scripts/new_android_sim.sh +++ b/scripts/new_android_sim.sh @@ -13,10 +13,27 @@ AVD_NAME="testavd" AVD_TAG="google_atd" AVD_IMAGE="system-images;android-30;$AVD_TAG;$ANDROID_ABI" AVD_DEVICE="Nexus 10" + +SDKMANAGER=$ANDROID_SDK_ROOT/tools/bin/sdkmanager +AVDMANAGER=$ANDROID_SDK_ROOT/tools/bin/avdmanager +if ! command -v $SDKMANAGER; then + SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager + AVDMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager + if ! command -v $SDKMANAGER; then + echo "Can't find 'sdkmanager' in the usual places." + exit + fi +fi +EMULATOR=$ANDROID_SDK_ROOT/emulator/emulator +if ! command -v $EMULATOR; then + echo "Can't find 'emulator' in the usual places." + exit +fi + # Install AVD image -$ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "$AVD_IMAGE" +$SDKMANAGER --install "$AVD_IMAGE" # Make AVD -echo "no" | $ANDROID_SDK_ROOT/tools/bin/avdmanager --verbose create avd --force --name "$AVD_NAME" --package "$AVD_IMAGE" --tag "$AVD_TAG" --abi "$ANDROID_ABI" --device "$AVD_DEVICE" +echo "no" | $AVDMANAGER --verbose create avd --force --name "$AVD_NAME" --package "$AVD_IMAGE" --tag "$AVD_TAG" --abi "$ANDROID_ABI" --device "$AVD_DEVICE" # Run emulator $ANDROID_SDK_ROOT/emulator/emulator -avd testavd -no-snapshot -no-boot-anim -no-window & ( trap exit SIGINT ; read -r -d '' _