ci: export ANDROID_NDK_ROOT for Gobley plugin

Real cause of the lsposed/lint NPE on CI: Gobley's
RustAndroidTarget.ndkToolchainDir resolves the NDK by checking, in
order, the explicit `ndkRoot` parameter, `<sdkRoot>/ndk/<latestVersion>`,
then `$ANDROID_NDK_ROOT`. The CI image installs the NDK as a separate
tree at /opt/android-ndk and exports `ANDROID_NDK_HOME`, not
`ANDROID_NDK_ROOT` — so all three lookups return null and Gobley's `!!`
produces a bare `NullPointerException` during `:app` configuration.

Locally my shell exports `ANDROID_NDK_ROOT` (Android Studio convention),
which is why the issue only surfaces in CI.

Bake `ANDROID_NDK_ROOT` into the CI Dockerfile and export it inline in
the lint / lsposed gradle steps so this PR's CI passes before the image
rebuilds. Revert the prior `rustup target add x86_64-unknown-linux-gnu`
and `--stacktrace` debug additions — that was a wrong-hypothesis
workaround (the host target is already installed by `rustup-init`).
This commit is contained in:
okhsunrog 2026-04-21 20:45:01 +03:00
parent c24aeccb4b
commit ecf8f5cd98
2 changed files with 18 additions and 15 deletions

View file

@ -50,7 +50,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --default-toolchain stable --profile minimal --no-modify-path && \
rustup target add aarch64-linux-android x86_64-unknown-linux-gnu && \
rustup target add aarch64-linux-android && \
rustup component add rustfmt clippy && \
cargo install cargo-ndk --locked && \
chmod -R a+w /usr/local/rustup /usr/local/cargo
@ -58,6 +58,9 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
# ── Android NDK (for zygisk) ─────────────────────────────────────────
ENV ANDROID_NDK_VERSION=r28b
ENV ANDROID_NDK_HOME=/opt/android-ndk
# Gobley's cargo plugin reads ANDROID_NDK_ROOT (not _HOME) to find the NDK
# when looking up the toolchain library directory for Android Rust targets.
ENV ANDROID_NDK_ROOT=/opt/android-ndk
RUN curl -fsSL -o /tmp/ndk.zip \
"https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip" && \