Skip to content

Commit

Permalink
fix: android test emulator start-script (#984)
Browse files Browse the repository at this point in the history
* fix: android test emulator start-script

* Update start-android.sh

* Update start-android.sh

* pin android-test images to macOS 12

* try macOS 13 for the Android test runners

* pin to macOS 12 since 13 also failed

* Add clearer logging to emulator start script

* fix typo
  • Loading branch information
supervacuus authored May 6, 2024
1 parent dc43150 commit 46456ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ jobs:
# The Android emulator is currently only available on macos, see:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/android?view=azure-devops#test-on-the-android-emulator
- name: Android (old API/NDK)
os: macOs-latest
os: macOs-12
ANDROID_API: 16
ANDROID_NDK: 20.1.5948944
ANDROID_ARCH: x86
- name: Android (new API/NDK)
os: macOs-latest
ANDROID_API: 32
ANDROID_NDK: 25.0.8775105
os: macOs-12
ANDROID_API: 34
ANDROID_NDK: 26.1.10909125
ANDROID_ARCH: x86_64

name: ${{ matrix.name }}
Expand Down
17 changes: 15 additions & 2 deletions scripts/start-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,34 @@
# Adapted from:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/android?view=azure-devops#test-on-the-android-emulator

echo "java version:"
java -version
echo "javac version"
javac -version
echo "PATH: $PATH"

ARCH=${ANDROID_ARCH:-"x86"}
API_LEVEL=${ANDROID_API:-"29"}
AVD_EMULATOR_NAME="sentry_android_${ARCH}"
IMAGE=${ANDROID_IMAGE:-"system-images;android-${API_LEVEL};google_apis;${ARCH}"}

# Create an Android Virtual Device
echo "Create Test AVDs with..."
echo "ARCH = $ARCH"
echo "API_LEVEL = $API_LEVEL"
echo "AVD_EMULATOR_NAME = $AVD_EMULATOR_NAME"
echo "IMAGE = $IMAGE"
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n $AVD_EMULATOR_NAME -k "$IMAGE" --force

echo "List available AVDs..."
$ANDROID_HOME/emulator/emulator -list-avds

echo "Starting emulator..."

# Start emulator in background
echo "Starting emulator..."
nohup $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot > /dev/null 2>&1 &
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

echo "Emulator started."

0 comments on commit 46456ca

Please sign in to comment.