Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cmccarthyIrl committed Mar 9, 2024
1 parent 9f9d7ba commit dd14f0f
Showing 1 changed file with 12 additions and 30 deletions.
42 changes: 12 additions & 30 deletions .github/scripts/startEmulator.sh
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
#!/bin/bash
echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "system-images;android-31;default;x86_64" --verbose
echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager -v create avd \
-n testRunnner \
-k "system-images;android-31;default;x86_64" \
--force
echo "Emulators:"
$ANDROID_HOME/emulator/emulator -list-avds

# Install Android SDK Platform Tools if not already installed
echo "Install Android SDK Platform Tools if not already installed..."
if ! command -v adb &> /dev/null; then
echo "Installing Android SDK Platform Tools..."
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "platform-tools" --verbose > /dev/null
fi

# Find adb executable
ADB=$(find "$ANDROID_HOME" -name adb -type f -print -quit)

if [ -z "$ADB" ]; then
echo "ADB not found in $ANDROID_HOME or its subdirectories."
exit 1
fi

# Start emulator in the background
echo "Start emulator in the background..."
nohup $EMULATOR -avd testRunner \
nohup $ANDROID_HOME/emulator/emulator -avd testRunnner \
-skin 1080x1920 \
-no-snapshot \
-no-audio \
-no-boot-anim \
-accel auto \
-gpu auto \
-qemu -lcd-density 420 > /dev/null 2>&1 &

# Wait for device to boot completely
echo "Waiting for the device to boot..."
$ADB wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done'

# List connected devices
echo "Connected Devices:"
$ADB devices

echo "Emulator started"
-qemu -lcd-density 420 > /dev/null 2>&1 & \
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done'
$ANDROID_HOME/platform-tools/adb devices
echo "Emulator started"

0 comments on commit dd14f0f

Please sign in to comment.