{"record":{"id":"c5aeef7a0617734c","repo":"tauri-apps/tauri","slug":"android-ndk-not-found-make-sure-the-ndk-is-instal","errorCode":null,"errorMessage":"Android NDK not found. Make sure the NDK is installed and the NDK_HOME environment variable is set.","messagePattern":"Android NDK not found\\. Make sure the NDK is installed and the NDK_HOME environment variable is set\\.","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/android/mod.rs","lineNumber":625,"sourceCode":"      );\n    }\n  } else {\n    read_dir(android_home.join(\"ndk\"))\n      .map(|dir| {\n        dir\n          .into_iter()\n          .flat_map(|e| e.ok().map(|e| e.path()))\n          .collect::<Vec<_>>()\n      })\n      .unwrap_or_default()\n  };\n  installed_ndks.sort();\n\n  if let Some(ndk) = installed_ndks.last() {\n    log::info!(\"Using installed NDK: {}\", ndk.display());\n    std::env::set_var(\"NDK_HOME\", ndk);\n  } else if non_interactive {\n    crate::error::bail!(\"Android NDK not found. Make sure the NDK is installed and the NDK_HOME environment variable is set.\");\n  } else {\n    let sdk_manager_path = android_home\n      .join(\"cmdline-tools/bin/sdkmanager\")\n      .with_extension(if cfg!(windows) { \"bat\" } else { \"\" });\n\n    let mut granted_permission_to_install = false;\n\n    if !sdk_manager_path.exists() {\n      granted_permission_to_install = crate::helpers::prompts::confirm(\n        \"Do you want to install the Android Studio command line tools to setup the Android NDK?\",\n        Some(false),\n      )\n      .unwrap_or_default();\n\n      if !granted_permission_to_install {\n        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\");\n      }\n","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/android/mod.rs#L607-L643","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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`","Or install the NDK through Android Studio > SDK Manager > SDK Tools > NDK (Side by side)","On CI, preinstall the NDK in the pipeline (e.g. android-actions/setup-androidSdk or an image with NDK) before invoking tauri","Verify with `test -d $NDK_HOME` before running tauri"],"exampleFix":"# before\ntauri android build --ci   # NDK_HOME unset, $ANDROID_HOME/ndk empty\n# after\n$ANDROID_HOME/cmdline-tools/bin/sdkmanager --install \"ndk;27.0.0\"\nexport NDK_HOME=\"$ANDROID_HOME/ndk/27.0.0\"\ntauri android build --ci","handlingStrategy":"validation","validationCode":"test -d \"$ANDROID_HOME/ndk\" && ls \"$ANDROID_HOME/ndk\" | grep -q . || {\n  sdkmanager --install \"ndk;27.0.0\"\n  export NDK_HOME=\"$ANDROID_HOME/ndk/27.0.0\"\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat NDK_HOME as a required CI secret/variable for every Android build job","Preinstall the NDK in the CI image or a setup-android step","Add a preflight check that both $ANDROID_HOME/ndk is non-empty and $NDK_HOME exists"],"tags":["android","ndk","environment","ci","setup"],"backgroundTag":"android-ndk-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}