android-actions/setup-android assumes a GitHub-hosted image with the SDK already present, and fails on a bare self-hosted host runner. Install cmdline-tools directly instead — same approach verified locally, and it persists in $HOME between runs so it's a one-time cost. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
06c0e546e9
commit
fd64fb9a30
2 files changed
+37
-2
No files matched your search
+19
-1
@@ -18,8 +18,26 @@ jobs:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
|
||||
# Installed explicitly rather than via android-actions/setup-android,
|
||||
# which assumes a GitHub-hosted image with the SDK already present.
|
||||
# Persists in $HOME on this self-hosted runner, so it's a one-time cost.
|
||||
- name: Set up Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
run: |
|
||||
set -eu
|
||||
SDK="$HOME/android-sdk"
|
||||
if [ ! -d "$SDK/cmdline-tools/latest" ]; then
|
||||
mkdir -p "$SDK/cmdline-tools"
|
||||
curl -sSLo /tmp/cmdline-tools.zip \
|
||||
https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||
unzip -q /tmp/cmdline-tools.zip -d "$SDK/cmdline-tools"
|
||||
mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
|
||||
rm -f /tmp/cmdline-tools.zip
|
||||
fi
|
||||
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null 2>&1 || true
|
||||
"$SDK/cmdline-tools/latest/bin/sdkmanager" \
|
||||
"platform-tools" "platforms;android-35" "build-tools;35.0.0" >/dev/null
|
||||
echo "ANDROID_HOME=$SDK" >> "$GITHUB_ENV"
|
||||
echo "ANDROID_SDK_ROOT=$SDK" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v4
|
||||
|
||||
@@ -17,8 +17,25 @@ jobs:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
|
||||
# See ci.yml — installed explicitly rather than via
|
||||
# android-actions/setup-android, which assumes a GitHub-hosted image.
|
||||
- name: Set up Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
run: |
|
||||
set -eu
|
||||
SDK="$HOME/android-sdk"
|
||||
if [ ! -d "$SDK/cmdline-tools/latest" ]; then
|
||||
mkdir -p "$SDK/cmdline-tools"
|
||||
curl -sSLo /tmp/cmdline-tools.zip \
|
||||
https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||
unzip -q /tmp/cmdline-tools.zip -d "$SDK/cmdline-tools"
|
||||
mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
|
||||
rm -f /tmp/cmdline-tools.zip
|
||||
fi
|
||||
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null 2>&1 || true
|
||||
"$SDK/cmdline-tools/latest/bin/sdkmanager" \
|
||||
"platform-tools" "platforms;android-35" "build-tools;35.0.0" >/dev/null
|
||||
echo "ANDROID_HOME=$SDK" >> "$GITHUB_ENV"
|
||||
echo "ANDROID_SDK_ROOT=$SDK" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v4
|
||||
|
||||
Reference in new issue
Block a user