tauri-apps/tauri · error · tauri_cli::error::Error

Android NDK not found. Make sure the NDK is installed and th

Error message

Android NDK not found. Make sure the NDK is installed and the NDK_HOME environment variable is set.

What it means

ensure_ndk() found no usable NDK: NDK_HOME is unset (or being auto-detected) and the $ANDROID_HOME/ndk directory is empty or missing, so `installed_ndks` is empty. In non-interactive mode the CLI cannot prompt to install the NDK via sdkmanager, so it aborts and asks you to install the NDK and set NDK_HOME yourself.

Source

Thrown at crates/tauri-cli/src/mobile/android/mod.rs:625

      );
    }
  } else {
    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 {
    crate::error::bail!("Android NDK not found. Make sure the NDK is installed and the NDK_HOME environment variable is set.");
  } else {
    let sdk_manager_path = android_home
      .join("cmdline-tools/bin/sdkmanager")
      .with_extension(if cfg!(windows) { "bat" } else { "" });

    let mut granted_permission_to_install = false;

    if !sdk_manager_path.exists() {
      granted_permission_to_install = crate::helpers::prompts::confirm(
        "Do you want to install the Android Studio command line tools to setup the Android NDK?",
        Some(false),
      )
      .unwrap_or_default();

      if !granted_permission_to_install {
        crate::error::bail!("Skipping Android Studio command line tools installation. Please go through the manual setup process described in the documentation: https://tauri.app/start/prerequisites/#android");
      }

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Install the required NDK: `sdkmanager --install "ndk;27.0.0"` (use the version your tauri-cli expects) and set `export NDK_HOME=$ANDROID_HOME/ndk/27.0.0`
  2. Or install the NDK through Android Studio > SDK Manager > SDK Tools > NDK (Side by side)
  3. On CI, preinstall the NDK in the pipeline (e.g. android-actions/setup-androidSdk or an image with NDK) before invoking tauri
  4. Verify with `test -d $NDK_HOME` before running tauri

Example fix

# before
tauri android build --ci   # NDK_HOME unset, $ANDROID_HOME/ndk empty
# after
$ANDROID_HOME/cmdline-tools/bin/sdkmanager --install "ndk;27.0.0"
export NDK_HOME="$ANDROID_HOME/ndk/27.0.0"
tauri android build --ci
Defensive patterns

Strategy: validation

Validate before calling

test -d "$ANDROID_HOME/ndk" && ls "$ANDROID_HOME/ndk" | grep -q . || {
  sdkmanager --install "ndk;27.0.0"
  export NDK_HOME="$ANDROID_HOME/ndk/27.0.0"
}

Prevention

When it happens

Trigger: Running `tauri android ...` with --ci while NDK_HOME is unset and $ANDROID_HOME/ndk contains no NDK installations (SDK installed without NDK, or NDK folder removed).

Common situations: CI images that preinstall only platform-tools; SDKs installed via Android Studio defaults where the NDK checkbox was never ticked; SDK moved to a new ANDROID_HOME without copying the ndk folder.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/c5aeef7a0617734c. Report an issue: GitHub.