CI: install NDK+CMake via sdkmanager and self-heal corrupt cache
All checks were successful
Build Android APK / build-apk (push) Successful in 32m4s
All checks were successful
Build Android APK / build-apk (push) Successful in 32m4s
The build failed with "Archive is not a ZIP archive" when AGP auto-downloaded NDK 27.1.12297006 mid-build (truncated archive). Install the NDK and CMake up front via sdkmanager (checksum-verified, robust) so AGP finds them already present, and wipe any incomplete ndk/cmake dir (missing source.properties) left in the cache volume by a failed run so it reinstalls cleanly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
8b202e4942
commit
83e2af6ed3
1 changed files with 17 additions and 2 deletions
|
|
@ -85,10 +85,25 @@ jobs:
|
||||||
fi
|
fi
|
||||||
export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"
|
export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"
|
||||||
yes | sdkmanager --licenses >/dev/null 2>&1 || true
|
yes | sdkmanager --licenses >/dev/null 2>&1 || true
|
||||||
# sdkmanager is a no-op for packages already present in the volume.
|
# Self-heal a corrupt/incomplete NDK or CMake left by a failed run
|
||||||
|
# (AGP's auto-installer sometimes leaves a truncated archive -> the
|
||||||
|
# "Archive is not a ZIP archive" failure). A valid package always has
|
||||||
|
# a source.properties; if it's missing, wipe the dir so sdkmanager
|
||||||
|
# reinstalls cleanly.
|
||||||
|
NDK_VER=27.1.12297006
|
||||||
|
CMAKE_VER=3.22.1
|
||||||
|
for p in "ndk/$NDK_VER" "cmake/$CMAKE_VER"; do
|
||||||
|
if [ -d "$ANDROID_HOME/$p" ] && [ ! -f "$ANDROID_HOME/$p/source.properties" ]; then
|
||||||
|
echo "Removing incomplete $p"; rm -rf "$ANDROID_HOME/$p"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Install everything (incl. NDK + CMake) via sdkmanager, which is
|
||||||
|
# checksum-verified and robust — instead of letting Gradle/AGP auto-
|
||||||
|
# download the NDK mid-build. No-op for packages already valid.
|
||||||
sdkmanager --install "platform-tools" \
|
sdkmanager --install "platform-tools" \
|
||||||
"platforms;android-36" "platforms;android-35" \
|
"platforms;android-36" "platforms;android-35" \
|
||||||
"build-tools;36.0.0" "build-tools;35.0.0" >/dev/null
|
"build-tools;36.0.0" "build-tools;35.0.0" \
|
||||||
|
"ndk;$NDK_VER" "cmake;$CMAKE_VER" >/dev/null
|
||||||
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
|
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
|
||||||
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH"
|
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue