Skip to content

Commit

Permalink
introduce emulator and adb port to start script
Browse files Browse the repository at this point in the history
  • Loading branch information
supervacuus authored Nov 5, 2024
1 parent 36b0bb8 commit f427713
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/start-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ NDK_VERSION=${ANDROID_NDK:-"27.2.12479018"}
AVD_EMULATOR_NAME="sentry_android_${ARCH}"
IMAGE=${ANDROID_IMAGE:-"system-images;android-${API_LEVEL};google_apis;${ARCH}"}
NDK_PACKAGE=${NDK_IMAGE:-"ndk;${NDK_VERSION}"}
adb start-server

echo "List installed images..."
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --list
Expand All @@ -25,6 +26,7 @@ echo "ARCH = $ARCH"
echo "API_LEVEL = $API_LEVEL"
echo "AVD_EMULATOR_NAME = $AVD_EMULATOR_NAME"
echo "IMAGE = $IMAGE"
echo "ADB_SERVER_PORT =${ADB_SERVER_PORT}"

echo "Install image and NDK..."
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
Expand All @@ -46,11 +48,11 @@ nohup $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot > /de

# For debugging emulator start issues:
# echo "Starting emulator blocking..."
# $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot
# $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot -port "${EMULATOR_PORT}"

echo "Wait for emulator availability..."
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'ls'
echo "Verify emulator devices as running..."
$ANDROID_HOME/platform-tools/adb devices
$ANDROID_HOME/platform-tools/adb -s "emulator-${EMULATOR_PORT}" wait-for-device shell 'ls'
echo "Verify emulator devices are running..."
$ANDROID_HOME/platform-tools/adb -s "emulator-${EMULATOR_PORT}" devices

echo "Emulator started."

0 comments on commit f427713

Please sign in to comment.