From 79001843830df99d4e6f0286f5004d049dec6578 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sun, 9 Aug 2026 21:11:10 +0200 Subject: [PATCH] Point the Android Java build at the installed SDK jar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ANDROID_PLATFORM means "link native code for API 28" to cargo-ndk, but the android-build crate reads the same variable as "compile Java against platforms/android-28/android.jar" — a directory that does not exist in the image, because only the compile SDK is installed. Slint's Android backend builds a Java helper through that crate, so it panicked with "No Android platforms found" while android.jar sat in android-36. ANDROID_JAR is checked ahead of the platform lookup and settles it: Java compiles against the compile SDK, native code still links against MIN_API. The two are meant to differ; only the variable name is overloaded. Assisted-by: LLM --- docker/android/Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docker/android/Dockerfile b/docker/android/Dockerfile index 3f7057b..276240d 100644 --- a/docker/android/Dockerfile +++ b/docker/android/Dockerfile @@ -107,6 +107,19 @@ ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=${NDK_BIN}/aarch64-linux-android${ ENV CARGO_NDK_PLATFORM=${MIN_API} \ ANDROID_PLATFORM=${MIN_API} +# ANDROID_PLATFORM above means "link native code for API 28" to cargo-ndk, but +# the android-build crate reads the same variable as "compile Java against +# platforms/android-28/android.jar" — a directory that does not exist here, +# because only the compile SDK (ANDROID_API) is installed. Slint's Android +# backend builds a Java helper through that crate, so it panics with +# "No Android platforms found" while android.jar sits in android-36. +# +# ANDROID_JAR is checked ahead of the platform lookup and settles it: Java +# compiles against the compile SDK, native code still links against MIN_API. +# The two are meant to differ (see the README's compile-SDK-versus-min-API +# note); only the variable name is overloaded. +ENV ANDROID_JAR=${ANDROID_HOME}/platforms/android-${ANDROID_API}/android.jar + # Crates with C or assembly components (ring's crypto core, and anything else # using the cc crate) need a compiler and archiver per target, not just a # linker. cargo-ndk sets the linker only, so these are set explicitly —