From da8ad4c1b3351ef92a82f522f6de912432cc6474 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Thu, 20 Aug 2026 22:48:32 +0200 Subject: [PATCH] Unpack the Android tools where sdkmanager expects to find them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The image had never been built successfully, which is why the registry has never held it and why every CI run since the workflows landed died at the pull. The commandlinetools zip carries a single top-level `cmdline-tools/`. Unzipping it straight into $ANDROID_HOME therefore lands `bin/` exactly where `latest/` has to go, and the `mv cmdline-tools/cmdline-tools/*` that followed matched nothing: mv: cannot stat '/opt/android-sdk/cmdline-tools/cmdline-tools/*' So unpack into /tmp and move that directory into place instead. sdkmanager derives the SDK root from its own path and refuses to run from anywhere but cmdline-tools/latest/, so the layout is not cosmetic — and a `test -x` on it now fails the build here rather than three layers later, where the error is a licence prompt that never returns. Verified in the pushed image: node 20.20.2, npm 10.8.2, jq 1.7, JDK 17, tauri-cli 2.11.4, NDK 27.0.11902837, and all three Android targets. Co-Authored-By: Claude Opus 5 (1M context) --- Dockerfile.builder | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index a3a4307..f6b1bc6 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -78,11 +78,17 @@ RUN . "$CARGO_HOME/env" && cargo install tauri-cli --locked --version "^2" RUN mkdir -p "$ANDROID_HOME" /root/.android && \ printf '### User Sources for `android` cmd line tool ###\ncount=0\n' > /root/.android/repositories.cfg && \ wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/cmdline-tools.zip && \ - unzip -q /tmp/cmdline-tools.zip -d "$ANDROID_HOME" && \ + # The zip holds a single top-level cmdline-tools/, and sdkmanager insists on + # living in cmdline-tools/latest/ — it derives the SDK root from its own + # path and refuses to run from anywhere else. So unpack somewhere neutral + # and move that directory into place; unzipping straight into $ANDROID_HOME + # puts bin/ where latest/ has to go. + unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools && \ rm /tmp/cmdline-tools.zip && \ - mkdir -p "$ANDROID_HOME/cmdline-tools/latest" && \ - mv "$ANDROID_HOME/cmdline-tools/cmdline-tools/"* "$ANDROID_HOME/cmdline-tools/latest/" && \ - rmdir "$ANDROID_HOME/cmdline-tools/cmdline-tools" + mkdir -p "$ANDROID_HOME/cmdline-tools" && \ + mv /tmp/cmdline-tools/cmdline-tools "$ANDROID_HOME/cmdline-tools/latest" && \ + rmdir /tmp/cmdline-tools && \ + test -x "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" # Licences up front so Gradle never blocks on a prompt in CI. RUN yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$ANDROID_HOME" --licenses > /dev/null