-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Replace the use of the ANDROID_SDK_ROOT
env variable with ANDROID_HOME
#84316
Conversation
platform/android/detect.py
Outdated
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")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the fallback also have a fallback? Not sure what -1
achieved, should maybe be an empty string? Otherwise it may be None and lead to errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought None
was preferred, so we can do things like if get_env_android_sdk_root():
.
I'm no python expert so happy to defer to the recommended practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well currently the only use of get_env_android_sdk_root()
is here:
("ANDROID_HOME", "Path to the Android SDK", get_env_android_sdk_root()),
Which means env["ANDROID_HOME"]
would be None
, and thus code like env["ANDROID_HOME"] + "/ndk/" + get_ndk_version()
will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the empty string as a fallback. We have various os.path.exists(...)
checks so they should quickly detect if env["ANDROID_HOME"]
has an invalid value / path.
3b26a71
to
2b71d73
Compare
…HOME` as the former is deprecated. See https://developer.android.com/tools/variables#android_home for more details
2b71d73
to
a1ca4ba
Compare
Thanks! |
Replace the use of the
ANDROID_SDK_ROOT
env variable withANDROID_HOME
as the former is deprecated.See https://developer.android.com/tools/variables#android_home for more details.
Fixes #80910