diff --git a/app/build.gradle b/app/build.gradle index 06327965..6f2c7dff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -191,7 +191,7 @@ tasks.register('provisionEmulator', Exec) { "seedvault", "system-images;android-33;google_apis;x86_64" - environment "ANDROID_SDK_HOME", android.sdkDirectory.absolutePath + environment "ANDROID_HOME", android.sdkDirectory.absolutePath environment "JAVA_HOME", System.properties['java.home'] } } @@ -202,7 +202,7 @@ tasks.register('startEmulator', Exec) { doFirst { commandLine "${project.projectDir}/development/scripts/start_emulator.sh", "seedvault" - environment "ANDROID_SDK_HOME", android.sdkDirectory.absolutePath + environment "ANDROID_HOME", android.sdkDirectory.absolutePath environment "JAVA_HOME", System.properties['java.home'] } } @@ -215,7 +215,7 @@ tasks.register('installEmulatorRelease', Exec) { doFirst { commandLine "${project.projectDir}/development/scripts/install_app.sh" - environment "ANDROID_SDK_HOME", android.sdkDirectory.absolutePath + environment "ANDROID_HOME", android.sdkDirectory.absolutePath environment "JAVA_HOME", System.properties['java.home'] } } @@ -226,7 +226,7 @@ tasks.register('clearEmulatorAppData', Exec) { doFirst { commandLine "${project.projectDir}/development/scripts/clear_app_data.sh" - environment "ANDROID_SDK_HOME", android.sdkDirectory.absolutePath + environment "ANDROID_HOME", android.sdkDirectory.absolutePath environment "JAVA_HOME", System.properties['java.home'] } } diff --git a/app/development/scripts/clear_app_data.sh b/app/development/scripts/clear_app_data.sh index fbde98b6..8bf4b978 100755 --- a/app/development/scripts/clear_app_data.sh +++ b/app/development/scripts/clear_app_data.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash # assert ANDROID_HOME is set -if [ -z "$ANDROID_SDK_HOME" ]; then - echo "ANDROID_SDK_HOME is not set" +if [ -z "$ANDROID_HOME" ]; then + echo "ANDROID_HOME is not set" exit 1 fi @@ -10,13 +10,13 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) DEVELOPMENT_DIR=$SCRIPT_DIR/.. ROOT_PROJECT_DIR=$SCRIPT_DIR/../../.. -EMULATOR_DEVICE_NAME=$($ANDROID_SDK_HOME/platform-tools/adb devices | grep emulator | cut -f1) +EMULATOR_DEVICE_NAME=$($ANDROID_HOME/platform-tools/adb devices | grep emulator | cut -f1) if [ -z "$EMULATOR_DEVICE_NAME" ]; then echo "Emulator device name not found" exit 1 fi -ADB="$ANDROID_SDK_HOME/platform-tools/adb -s $EMULATOR_DEVICE_NAME" +ADB="$ANDROID_HOME/platform-tools/adb -s $EMULATOR_DEVICE_NAME" $ADB shell pm clear com.stevesoltys.seedvault diff --git a/app/development/scripts/install_app.sh b/app/development/scripts/install_app.sh index 05bd3ee1..6891cad5 100755 --- a/app/development/scripts/install_app.sh +++ b/app/development/scripts/install_app.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash # assert ANDROID_HOME is set -if [ -z "$ANDROID_SDK_HOME" ]; then - echo "ANDROID_SDK_HOME is not set" +if [ -z "$ANDROID_HOME" ]; then + echo "ANDROID_HOME is not set" exit 1 fi @@ -10,14 +10,14 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) DEVELOPMENT_DIR=$SCRIPT_DIR/.. ROOT_PROJECT_DIR=$SCRIPT_DIR/../../.. -EMULATOR_DEVICE_NAME=$($ANDROID_SDK_HOME/platform-tools/adb devices | grep emulator | cut -f1) +EMULATOR_DEVICE_NAME=$($ANDROID_HOME/platform-tools/adb devices | grep emulator | cut -f1) if [ -z "$EMULATOR_DEVICE_NAME" ]; then echo "Emulator device name not found" exit 1 fi -ADB="$ANDROID_SDK_HOME/platform-tools/adb -s $EMULATOR_DEVICE_NAME" +ADB="$ANDROID_HOME/platform-tools/adb -s $EMULATOR_DEVICE_NAME" $ADB root sleep 3 # wait for adb to restart diff --git a/app/development/scripts/provision_emulator.sh b/app/development/scripts/provision_emulator.sh index 8af6504f..e8d45917 100755 --- a/app/development/scripts/provision_emulator.sh +++ b/app/development/scripts/provision_emulator.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash # assert ANDROID_HOME is set -if [ -z "$ANDROID_SDK_HOME" ]; then - echo "ANDROID_SDK_HOME is not set" +if [ -z "$ANDROID_HOME" ]; then + echo "ANDROID_HOME is not set" exit 1 fi @@ -20,14 +20,14 @@ DEVELOPMENT_DIR=$SCRIPT_DIR/.. ROOT_PROJECT_DIR=$SCRIPT_DIR/../../.. echo "Downloading system image..." -$ANDROID_SDK_HOME/cmdline-tools/latest/bin/sdkmanager --install "$SYSTEM_IMAGE" +$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "$SYSTEM_IMAGE" # create AVD if it doesn't exist -if $ANDROID_SDK_HOME/cmdline-tools/latest/bin/avdmanager list avd | grep -q "$EMULATOR_NAME"; then +if $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager list avd | grep -q "$EMULATOR_NAME"; then echo "AVD already exists. Skipping creation." else echo "Creating AVD..." - echo 'no' | $ANDROID_SDK_HOME/cmdline-tools/latest/bin/avdmanager create avd -n "$EMULATOR_NAME" -k "$SYSTEM_IMAGE" + echo 'no' | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n "$EMULATOR_NAME" -k "$SYSTEM_IMAGE" sleep 1 fi @@ -35,14 +35,14 @@ $SCRIPT_DIR/start_emulator.sh "$EMULATOR_NAME" sleep 3 # get emulator device name from ADB -EMULATOR_DEVICE_NAME=$($ANDROID_SDK_HOME/platform-tools/adb devices | grep emulator | cut -f1) +EMULATOR_DEVICE_NAME=$($ANDROID_HOME/platform-tools/adb devices | grep emulator | cut -f1) if [ -z "$EMULATOR_DEVICE_NAME" ]; then echo "Emulator device name not found" exit 1 fi -ADB="$ANDROID_SDK_HOME/platform-tools/adb -s $EMULATOR_DEVICE_NAME" +ADB="$ANDROID_HOME/platform-tools/adb -s $EMULATOR_DEVICE_NAME" echo "Waiting for emulator to boot..." $ADB wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;' diff --git a/app/development/scripts/start_emulator.sh b/app/development/scripts/start_emulator.sh index 387388df..616a538b 100755 --- a/app/development/scripts/start_emulator.sh +++ b/app/development/scripts/start_emulator.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash # assert ANDROID_HOME is set -if [ -z "$ANDROID_SDK_HOME" ]; then - echo "ANDROID_SDK_HOME is not set" +if [ -z "$ANDROID_HOME" ]; then + echo "ANDROID_HOME is not set" exit 1 fi @@ -19,4 +19,4 @@ DEVELOPMENT_DIR=$SCRIPT_DIR/.. ROOT_PROJECT_DIR=$SCRIPT_DIR/../../.. echo "Starting emulator..." -nohup $ANDROID_SDK_HOME/emulator/emulator -avd "$EMULATOR_NAME" -gpu swiftshader_indirect -writable-system -no-snapshot-load >/dev/null 2>&1 & +nohup $ANDROID_HOME/emulator/emulator -avd "$EMULATOR_NAME" -gpu swiftshader_indirect -writable-system -no-snapshot-load >/dev/null 2>&1 &