From 1803aaebaa4f5215f43a1d2d848af5ead629a3ba Mon Sep 17 00:00:00 2001 From: wysaid Date: Mon, 16 Jan 2023 13:31:35 +0800 Subject: [PATCH] fix sdk detection --- vscode_tasks.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vscode_tasks.sh b/vscode_tasks.sh index 6ae5f91f..add23e9a 100755 --- a/vscode_tasks.sh +++ b/vscode_tasks.sh @@ -88,10 +88,16 @@ function buildProject() { } if [[ ! -f "local.properties" ]]; then - if [[ -n "$ANDROID_SDK_HOME" ]]; then - echo "sdk.dir=$ANDROID_SDK_HOME" >>local.properties + if [[ -n "$ANDROID_HOME" ]]; then + echo "sdk.dir=$ANDROID_HOME" >>local.properties elif [[ -n "$ANDROID_SDK_ROOT" ]]; then echo "sdk.dir=$ANDROID_SDK_ROOT" >>local.properties + elif [[ -n "$ANDROID_SDK_HOME" ]]; then + if [[ -d "$ANDROID_SDK_HOME/platform-tools" ]]; then + echo "sdk.dir=$ANDROID_SDK_HOME" >>local.properties + elif [[ -d "$ANDROID_SDK_HOME/../platform-tools" ]]; then + echo "sdk.dir=$(realpath $ANDROID_SDK_HOME/../platform-tools)" >>local.properties + fi elif [[ -n "$ANDROID_SDK" ]]; then echo "sdk.dir=$ANDROID_SDK" >>local.properties else