Skip to content

[feat] Honor a specified NDK version, if set #14860

@NyaomiDEV

Description

@NyaomiDEV

Describe the problem

Latest Tauri versions try to build using the latest NDK which is installed in the system - not the specified NDK through the NDK_HOME variable. This means it's impossible to reproduce a build within build systems, and this adds unnecessary friction should developers want their apps to be reproducible by others (such as the guys over at F-Droid / IzzyOnDroid.)

Describe the solution you'd like

If NDK_HOME is set, Tauri should honor that instead of trying to get the latest NDK from $ANDROID_HOME/ndk.

Ref:

// re-evaluate ANDROID_HOME
let android_home = std::env::var_os("ANDROID_HOME")
.or_else(|| std::env::var_os("ANDROID_SDK_ROOT"))
.map(PathBuf::from)
.context("Failed to locate Android SDK")?;
let mut installed_ndks = read_dir(android_home.join("ndk"))
.map(|dir| {
dir
.into_iter()
.flat_map(|e| e.ok().map(|e| e.path()))
.collect::<Vec<_>>()
})
.unwrap_or_default();
installed_ndks.sort();
if let Some(ndk) = installed_ndks.last() {
log::info!("Using installed NDK: {}", ndk.display());
std::env::set_var("NDK_HOME", ndk);
} else if non_interactive {

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions