{"record":{"id":"308ebec60daf0561","repo":"tauri-apps/tauri","slug":"failed-to-install-android-ndk","errorCode":null,"errorMessage":"Failed to install Android NDK","messagePattern":"Failed to install Android NDK","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/android/mod.rs","lineNumber":678,"sourceCode":"      \"Running sdkmanager to install ndk-{NDK_VERSION} on {}...\",\n      android_home.display()\n    );\n    let status = Command::new(&sdk_manager_path)\n      .arg(format!(\"--sdk_root={}\", android_home.display()))\n      .arg(\"--install\")\n      .arg(format!(\"ndk;{NDK_VERSION}\"))\n      .status()\n      .map_err(|error| Error::CommandFailed {\n        command: format!(\n          \"{} --sdk_root={} --install ndk;{NDK_VERSION}\",\n          sdk_manager_path.display(),\n          android_home.display()\n        ),\n        error,\n      })?;\n\n    if !status.success() {\n      crate::error::bail!(\"Failed to install Android NDK\");\n    }\n\n    let ndk_path = android_home.join(\"ndk\").join(NDK_VERSION);\n    log::info!(\"Installed NDK: {}\", ndk_path.display());\n    std::env::set_var(\"NDK_HOME\", ndk_path);\n  }\n\n  Ok(())\n}\n\nfn delete_codegen_vars() {\n  for (k, _) in std::env::vars() {\n    if k.starts_with(\"WRY_\") && (k.ends_with(\"CLASS_EXTENSION\") || k.ends_with(\"CLASS_INIT\")) {\n      std::env::remove_var(k);\n    }\n  }\n}\n","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/android/mod.rs#L660-L696","documentation":"sdkmanager was launched to install ndk;{NDK_VERSION} but exited non-zero. The command line is included in the error context; the sdkmanager output above it usually reveals the real cause (unaccepted license, download failure, disk space, or a broken Java installation).","triggerScenarios":"`sdkmanager --sdk_root=... --install ndk;X` failing — most often 'License not accepted' for the NDK package, network errors downloading the ~1GB archive, or java.io errors.","commonSituations":"CI never accepting NDK licenses; flaky networks/proxies during the large NDK download; Docker layers running out of disk; ANDROID_HOME on a filesystem that ran out of inodes/space.","solutions":["Run the exact sdkmanager command from the error output manually and read the failure reason","Accept licenses: `yes | sdkmanager --licenses`, then retry the tauri command","Free disk space (NDK needs ~2GB+) and check network/proxy, then retry","Pin/cache the NDK in CI so the install step succeeds once and is reused"],"exampleFix":"# before\nerror: Failed to install Android NDK\n# after\nyes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --licenses\n$ANDROID_HOME/cmdline-tools/bin/sdkmanager --install \"ndk;27.0.0\"\ntauri android dev","handlingStrategy":"retry","validationCode":"yes | sdkmanager --licenses >/dev/null 2>&1\ndf -h \"$ANDROID_HOME\" | tail -1   # NDK archive is ~1-2GB","typeGuard":null,"tryCatchPattern":"#!/usr/bin/env bash\nfor i in 1 2 3; do\n  tauri android dev && exit 0\necho \"retry $i: NDK install failed (licenses/network/disk?)\"\ndone\nexit 1","preventionTips":["Accept NDK licenses up front in CI","Cache the installed NDK directory between builds","Check disk space and proxy settings before builds that may download the NDK"],"tags":["android","ndk","sdkmanager","licenses","network","disk-space"],"backgroundTag":"sdkmanager-install-failed","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}