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
Problem
scripts/build_android_library.shcurrently derives GradleANDROID_HOMEonly fromANDROID_SDK, with/opt/android/sdkas the fallback. GitHub Android runners and many developer environments setANDROID_HOMEorANDROID_SDK_ROOTinstead, 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, thenANDROID_HOME, thenANDROID_SDK_ROOT, with the existing fallback. Pass the resolved path to Gradle through both standard variables.Test plan
cc @larryliu0820 @GregoryComer @kirklandsign @cbilgin