tauri-apps/tauri · error
Android SDK not found. Make sure the SDK and NDK are install
Error message
Android SDK not found. Make sure the SDK and NDK are installed and the ANDROID_HOME and NDK_HOME environment variables are set.
What it means
Thrown by the Tauri CLI's Android environment setup (ensure_android_dev) when ANDROID_HOME/ANDROID_SDK_ROOT are unset or invalid AND the default per-OS SDK location (macOS: ~/Library/Android/sdk, Linux: ~/Android/Sdk, Windows: %LOCALAPPDATA%\Android\Sdk) does not exist. In non-interactive mode (--ci) the CLI cannot prompt to download the command line tools, so it aborts immediately instead of offering automatic setup.
Source
Thrown at crates/tauri-cli/src/mobile/android/mod.rs:523
} else {
"not set".into()
}
);
#[cfg(target_os = "macos")]
let default_android_home = dirs::home_dir().unwrap().join("Library/Android/sdk");
#[cfg(target_os = "linux")]
let default_android_home = dirs::home_dir().unwrap().join("Android/Sdk");
#[cfg(windows)]
let default_android_home = dirs::data_local_dir().unwrap().join("Android/Sdk");
if default_android_home.exists() {
log::info!(
"Using installed Android SDK: {}",
default_android_home.display()
);
} else if non_interactive {
crate::error::bail!("Android SDK not found. Make sure the SDK and NDK are installed and the ANDROID_HOME and NDK_HOME environment variables are set.");
} else {
log::error!(
"Android SDK not found at {}",
default_android_home.display()
);
let extract_path = if create_dir_all(&default_android_home).is_ok() {
default_android_home.clone()
} else {
std::env::current_dir().context("failed to get current directory")?
};
let sdk_manager_path = extract_path
.join("cmdline-tools/bin/sdkmanager")
.with_extension(if cfg!(windows) { "bat" } else { "" });
let mut granted_permission_to_install = false;
View on GitHub (pinned to 52e4b6e71d)
Solutions
- Install the Android SDK via Android Studio (or cmdline-tools) and export ANDROID_HOME and NDK_HOME to its root (e.g. export ANDROID_HOME=$HOME/Android/Sdk, export NDK_HOME=$ANDROID_HOME/ndk/<version>)
- Point ANDROID_HOME/ANDROID_SDK_ROOT at an existing SDK: `export ANDROID_HOME=/path/to/sdk`
- On CI, use a runner image with the SDK preinstalled (e.g. GitHub's macOS runners ship ~/Library/Android/sdk) or add a setup-android-sdk step before the tauri command
- Verify with `sdkmanager --version` or `test -d $ANDROID_HOME` before rerunning `tauri android` commands
Example fix
# before (CI job, no env) tauri android build --ci # after export ANDROID_HOME="$HOME/Library/Android/sdk" export NDK_HOME="$ANDROID_HOME/ndk/27.0.0" # your installed NDK version tauri android build --ci
Defensive patterns
Strategy: validation
Validate before calling
# before running any `tauri android` command in CI:
test -n "$ANDROID_HOME" && test -d "$ANDROID_HOME" || { echo "ANDROID_HOME missing"; exit 1; }
test -n "$NDK_HOME" && test -d "$NDK_HOME" || { echo "NDK_HOME missing"; exit 1; } Prevention
- Pre-install the Android SDK and NDK in your CI image or a setup step instead of relying on tauri's interactive bootstrap
- Export ANDROID_HOME and NDK_HOME in the CI job environment (not just your local shell profile)
- Validate SDK presence with a guard step that fails fast with a clearer message than the bail
When it happens
Trigger: Running `tauri android init`, `tauri android dev`, or `tauri android build` with --ci (non_interactive=true) on a machine where ANDROID_HOME and ANDROID_SDK_ROOT are not exported and the default SDK directory does not exist.
Common situations: CI runners without the Android SDK preinstalled; fresh machines where Android Studio was never launched (so the SDK directory was never created); ANDROID_HOME exported in an interactive shell profile that CI jobs do not source; the SDK installed in a non-default location.
Related errors
- Android NDK not found. Make sure the NDK is installed and th
- Skipping Android Studio command line tools installation. Ple
- Skipping Android Studio SDK installation. Please go through
- Android NDK invalid. Make sure the NDK_HOME environment vari
- No external IP detected.
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/811b02127e9f9e28.
Report an issue: GitHub.