Skip to content

[Android] Honor standard SDK environment variables in build_android_library.sh #22682

Description

@mergennachin

Problem

scripts/build_android_library.sh currently derives Gradle ANDROID_HOME only from ANDROID_SDK, with /opt/android/sdk as the fallback. GitHub Android runners and many developer environments set ANDROID_HOME or ANDROID_SDK_ROOT instead, so the script can ignore the configured SDK and point Gradle at the wrong path.

This was found while validating the Android documentation in #22620. The implementation change is intentionally excluded from that documentation-only PR.

Proposed change

Resolve the SDK path from ANDROID_SDK, then ANDROID_HOME, then ANDROID_SDK_ROOT, with the existing fallback. Pass the resolved path to Gradle through both standard variables.

Test plan

  • Exercise the script with each supported environment variable independently.
  • Run the Android AAR build job.
  • Run the Android emulator integration job.

cc @larryliu0820 @GregoryComer @kirklandsign @cbilgin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugmodule: androidIssues related to Android code, build, and executionmodule: build/installIssues related to the cmake and buck2 builds, and to installing ExecuTorch

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions