From e5292ca47df7113f198c839e5d44fe482e816bd4 Mon Sep 17 00:00:00 2001 From: EDMND-SRC Date: Sat, 17 Oct 2026 06:22:33 +0200 Subject: [PATCH] recipe: export ANDROID_API_LEVEL so maturin can build Rust wheels --- pythonforandroid/recipe.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index b826001dc..a96a82103 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -1649,6 +1649,10 @@ def get_recipe_env(self, arch, **kwargs): ) realpython_dir = self.ctx.python_recipe.get_build_dir(arch.arch) + # maturin (used by every Rust recipe here) refuses to build without the + # target Android API level: "Failed to determine Android API level." + env["ANDROID_API_LEVEL"] = str(self.ctx.ndk_api) + env["RUSTFLAGS"] = "-Clink-args=-L{} -L{}".format( self.ctx.get_libs_dir(arch.arch), join(realpython_dir, "android-build") )