Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the use of the ANDROID_SDK_ROOT env variable with ANDROID_HOME #84316

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions platform/android/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_opts():
from SCons.Variables import BoolVariable

return [
("ANDROID_SDK_ROOT", "Path to the Android SDK", get_env_android_sdk_root()),
("ANDROID_HOME", "Path to the Android SDK", get_env_android_sdk_root()),
(
"ndk_platform",
'Target platform (android-<api>, e.g. "android-' + str(get_min_target_api()) + '")',
Expand All @@ -41,17 +41,17 @@ def get_doc_path():
return "doc_classes"


# Return the ANDROID_SDK_ROOT environment variable.
# Return the ANDROID_HOME environment variable.
def get_env_android_sdk_root():
return os.environ.get("ANDROID_SDK_ROOT", -1)
return os.environ.get("ANDROID_HOME", os.environ.get("ANDROID_SDK_ROOT", ""))


def get_min_sdk_version(platform):
return int(platform.split("-")[1])


def get_android_ndk_root(env):
return env["ANDROID_SDK_ROOT"] + "/ndk/" + get_ndk_version()
return env["ANDROID_HOME"] + "/ndk/" + get_ndk_version()


# This is kept in sync with the value in 'platform/android/java/app/config.gradle'.
Expand All @@ -75,7 +75,7 @@ def get_flags():
# If not, install it.
def install_ndk_if_needed(env):
print("Checking for Android NDK...")
sdk_root = env["ANDROID_SDK_ROOT"]
sdk_root = env["ANDROID_HOME"]
if not os.path.exists(get_android_ndk_root(env)):
extension = ".bat" if os.name == "nt" else ""
sdkmanager = sdk_root + "/cmdline-tools/latest/bin/sdkmanager" + extension
Expand All @@ -87,7 +87,7 @@ def install_ndk_if_needed(env):
else:
print("Cannot find " + sdkmanager)
print(
"Please ensure ANDROID_SDK_ROOT is correct and cmdline-tools are installed, or install NDK version "
"Please ensure ANDROID_HOME is correct and cmdline-tools are installed, or install NDK version "
+ get_ndk_version()
+ " manually."
)
Expand Down
2 changes: 1 addition & 1 deletion platform/android/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void register_android_exporter_types() {

void register_android_exporter() {
#ifndef ANDROID_ENABLED
EDITOR_DEF("export/android/android_sdk_path", OS::get_singleton()->get_environment("ANDROID_SDK_ROOT"));
EDITOR_DEF("export/android/android_sdk_path", OS::get_singleton()->get_environment("ANDROID_HOME"));
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/android_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
EDITOR_DEF("export/android/debug_keystore", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/debug_keystore", PROPERTY_HINT_GLOBAL_FILE, "*.keystore,*.jks"));
Expand Down
Loading