[Android] Honor standard SDK environment variables in build_android_library.sh
@kirklandsign is already working on this.
Since Sep 10, 2026.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 581
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.