-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f9d7ba
commit dd14f0f
Showing
1 changed file
with
12 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |