Fix Android SDK provisioning for API 37

This commit is contained in:
bponders12-cell 2026-09-01 21:27:19 -04:00
parent 9074234fd3
commit 58ba2636f0
1 changed files with 13 additions and 3 deletions

View File

@ -18,7 +18,10 @@ env:
FLUTTER_VERSION: '3.44.6'
JAVA_VERSION: '17'
ANDROID_COMPILE_SDK: '37'
ANDROID_BUILD_TOOLS: '37.0.0'
# AGP 9.x uses 36.0.0 as its default build-tools revision; 37.0.0 is not a
# required SDK package for compiling against API 37 and may not be present
# in the runner's SDK repository yet.
ANDROID_BUILD_TOOLS: '36.0.0'
GRADLE_VERSION: '9.1.0'
jobs:
@ -66,7 +69,12 @@ jobs:
SDKROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}"
SDKMANAGER="$(find "$SDKROOT/cmdline-tools" -type f -name sdkmanager -print -quit 2>/dev/null || true)"
test -x "$SDKMANAGER"
"$SDKMANAGER" --licenses </dev/null >/dev/null 2>&1 || true
yes | "$SDKMANAGER" --licenses >/dev/null 2>&1 || true
# Refresh repository metadata before requesting API 37. The hosted
# runner can have an older cached package index even though API 37
# is available from the current Android SDK repository.
"$SDKMANAGER" --update >/dev/null 2>&1 || true
"$SDKMANAGER" --list | grep -F "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
"$SDKMANAGER" "platform-tools" "platforms;android-${ANDROID_COMPILE_SDK}" "build-tools;${ANDROID_BUILD_TOOLS}"
yes | "$SDKMANAGER" --licenses >/dev/null 2>&1 || true
echo "ANDROID_SDK_ROOT=$SDKROOT" >> "$GITHUB_ENV"
@ -168,7 +176,9 @@ jobs:
SDKROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}"
SDKMANAGER="$(find "$SDKROOT/cmdline-tools" -type f -name sdkmanager -print -quit 2>/dev/null || true)"
test -x "$SDKMANAGER"
"$SDKMANAGER" --licenses </dev/null >/dev/null 2>&1 || true
yes | "$SDKMANAGER" --licenses >/dev/null 2>&1 || true
"$SDKMANAGER" --update >/dev/null 2>&1 || true
"$SDKMANAGER" --list | grep -F "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
"$SDKMANAGER" "platform-tools" "platforms;android-${ANDROID_COMPILE_SDK}" "build-tools;${ANDROID_BUILD_TOOLS}"
yes | "$SDKMANAGER" --licenses >/dev/null 2>&1 || true
- name: Provision Gradle wrapper