From 3f0ad89ca96f11d0bfe1ff3bc845c01cc62a65f0 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 24 May 2025 11:19:37 +0200 Subject: [PATCH] gogio: use ANDROID_HOME instead of the deprecated ANDROID_SDK_ROOT Signed-off-by: Elias Naur --- gogio/android_test.go | 4 ++-- gogio/androidbuild.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gogio/android_test.go b/gogio/android_test.go index 9bba8c7..21b2aa9 100644 --- a/gogio/android_test.go +++ b/gogio/android_test.go @@ -24,9 +24,9 @@ type AndroidTestDriver struct { var rxAdbDevice = regexp.MustCompile(`(.*)\s+device$`) func (d *AndroidTestDriver) Start(path string) { - d.sdkDir = os.Getenv("ANDROID_SDK_ROOT") + d.sdkDir = os.Getenv("ANDROID_HOME") if d.sdkDir == "" { - d.Skipf("Android SDK is required; set $ANDROID_SDK_ROOT") + d.Skipf("Android SDK is required; set $ANDROID_HOME") } d.adbPath = filepath.Join(d.sdkDir, "platform-tools", "adb") if _, err := os.Stat(d.adbPath); os.IsNotExist(err) { diff --git a/gogio/androidbuild.go b/gogio/androidbuild.go index caaf130..37fa059 100644 --- a/gogio/androidbuild.go +++ b/gogio/androidbuild.go @@ -76,9 +76,9 @@ func init() { } func buildAndroid(tmpDir string, bi *buildInfo) error { - sdk := os.Getenv("ANDROID_SDK_ROOT") + sdk := os.Getenv("ANDROID_HOME") if sdk == "" { - return errors.New("please set ANDROID_SDK_ROOT to the Android SDK path") + return errors.New("please set ANDROID_HOME to the Android SDK path") } if _, err := os.Stat(sdk); err != nil { return err @@ -179,9 +179,9 @@ func buildAndroid(tmpDir string, bi *buildInfo) error { } func compileAndroid(tmpDir string, tools *androidTools, bi *buildInfo) (err error) { - androidHome := os.Getenv("ANDROID_SDK_ROOT") + androidHome := os.Getenv("ANDROID_HOME") if androidHome == "" { - return errors.New("ANDROID_SDK_ROOT is not set. Please point it to the root of the Android SDK") + return errors.New("ANDROID_HOME is not set. Please point it to the root of the Android SDK") } javac, err := findJavaC() if err != nil { @@ -744,7 +744,7 @@ func findNDK(androidHome string) (string, error) { if bestNDK, found := latestVersionPath(ndks); found { return bestNDK, nil } - // The old NDK path was $ANDROID_SDK_ROOT/ndk-bundle. + // The old NDK path was $ANDROID_HOME/ndk-bundle. ndkBundle := filepath.Join(androidHome, "ndk-bundle") if _, err := os.Stat(ndkBundle); err == nil { return ndkBundle, nil @@ -757,7 +757,7 @@ func findNDK(androidHome string) (string, error) { } } - return "", fmt.Errorf("no NDK found in $ANDROID_SDK_ROOT (%s). Set $ANDROID_NDK_ROOT or use `sdkmanager ndk-bundle` to install the NDK", androidHome) + return "", fmt.Errorf("no NDK found in $ANDROID_HOME (%s). Set $ANDROID_NDK_ROOT or use `sdkmanager ndk-bundle` to install the NDK", androidHome) } func findKeytool() (string, error) {