Point the Android Java build at the installed SDK jar
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
This commit is contained in:
@@ -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 —
|
||||
|
||||
Reference in New Issue
Block a user