Skip to content

Commit

Permalink
get rid of emulator and adb port in start-android.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
supervacuus authored Nov 5, 2024
1 parent ee9e155 commit d15db90
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions scripts/start-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ 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

# Create an Android Virtual Device
echo "Create Test AVDs with..."
Expand All @@ -27,8 +23,6 @@ echo "API_LEVEL = $API_LEVEL"
echo "AVD_EMULATOR_NAME = $AVD_EMULATOR_NAME"
echo "IMAGE = $IMAGE"
echo "NDK_PACKAGE = $NDK_PACKAGE"
echo "ADB_SERVER_PORT = $ADB_SERVER_PORT"
echo "EMULATOR_PORT = $EMULATOR_PORT"

echo "Install image and NDK..."
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
Expand All @@ -46,15 +40,15 @@ $ANDROID_HOME/emulator/emulator -accel-check

# Start emulator in background
echo "Starting emulator..."
nohup $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot -port "$EMULATOR_PORT" > /dev/null 2>&1 &
nohup $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot > /dev/null 2>&1 &

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

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

echo "Emulator started."

0 comments on commit d15db90

Please sign in to comment.