diff --git a/.github/scripts/startEmulator.sh b/.github/scripts/startEmulator.sh index d8e6eb2..a5957b9 100644 --- a/.github/scripts/startEmulator.sh +++ b/.github/scripts/startEmulator.sh @@ -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" \ No newline at end of file