android fixes

This commit is contained in:
Christien Rioux 2023-09-01 15:36:38 -04:00
parent 2200825e82
commit f79b13a6d1

View File

@ -13,10 +13,27 @@ AVD_NAME="testavd"
AVD_TAG="google_atd" AVD_TAG="google_atd"
AVD_IMAGE="system-images;android-30;$AVD_TAG;$ANDROID_ABI" AVD_IMAGE="system-images;android-30;$AVD_TAG;$ANDROID_ABI"
AVD_DEVICE="Nexus 10" 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 # Install AVD image
$ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "$AVD_IMAGE" $SDKMANAGER --install "$AVD_IMAGE"
# Make AVD # 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 # Run emulator
$ANDROID_SDK_ROOT/emulator/emulator -avd testavd -no-snapshot -no-boot-anim -no-window & $ANDROID_SDK_ROOT/emulator/emulator -avd testavd -no-snapshot -no-boot-anim -no-window &
( trap exit SIGINT ; read -r -d '' _ </dev/tty ) ## wait for Ctrl-C ( trap exit SIGINT ; read -r -d '' _ </dev/tty ) ## wait for Ctrl-C