fix(ci): install Android SDK command-line tools on ubuntu-latest runner
The Gitea Actions ubuntu-latest image does not include the Android SDK (unlike GitHub Actions). Add an explicit step to download cmdline-tools, install platform-tools, platforms;android-35, and build-tools;35.0.0, then export ANDROID_HOME and PATH via GITEA_ENV_FILE/GITEA_PATH_FILE so subsequent flutter precache and flutter build apk steps can find it.
This commit is contained in:
@@ -106,6 +106,20 @@ jobs:
|
|||||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
|
- name: Install Android SDK command-line tools
|
||||||
|
run: |
|
||||||
|
export ANDROID_HOME="${HOME}/android-sdk"
|
||||||
|
mkdir -p "${ANDROID_HOME}/cmdline-tools"
|
||||||
|
curl -fsSL "https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip" -o cmdline-tools.zip
|
||||||
|
unzip -q cmdline-tools.zip -d "${ANDROID_HOME}/cmdline-tools"
|
||||||
|
mv "${ANDROID_HOME}/cmdline-tools/cmdline-tools" "${ANDROID_HOME}/cmdline-tools/latest"
|
||||||
|
export PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${PATH}"
|
||||||
|
yes | sdkmanager --licenses >/dev/null 2>&1 || true
|
||||||
|
sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0"
|
||||||
|
echo "ANDROID_HOME=${ANDROID_HOME}" >> "${GITEA_ENV_FILE}"
|
||||||
|
echo "${ANDROID_HOME}/cmdline-tools/latest/bin" >> "${GITEA_PATH_FILE}"
|
||||||
|
echo "${ANDROID_HOME}/platform-tools" >> "${GITEA_PATH_FILE}"
|
||||||
|
|
||||||
- name: Pre-cache Android platform artifacts
|
- name: Pre-cache Android platform artifacts
|
||||||
run: flutter precache --android
|
run: flutter precache --android
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user