{"record":{"id":"33f8bf5823e47bae","repo":"tauri-apps/tauri","slug":"failed-to-install-android-sdk","errorCode":null,"errorMessage":"Failed to install Android SDK","messagePattern":"Failed to install Android SDK","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/android/mod.rs","lineNumber":582,"sourceCode":"          crate::error::bail!(\"Skipping Android Studio SDK installation. Please go through the manual setup process described in the documentation: https://tauri.app/start/prerequisites/#android\");\n        }\n      }\n\n      log::info!(\"Running sdkmanager to install platform-tools, android-{SDK_VERSION} and ndk-{NDK_VERSION} on {}...\", default_android_home.display());\n      let status = Command::new(&sdk_manager_path)\n        .arg(format!(\"--sdk_root={}\", default_android_home.display()))\n        .arg(\"--install\")\n        .arg(\"platform-tools\")\n        .arg(format!(\"platforms;android-{SDK_VERSION}\"))\n        .arg(format!(\"ndk;{NDK_VERSION}\"))\n        .status()\n        .map_err(|error| Error::CommandFailed {\n          command: format!(\"{} --sdk_root={} --install platform-tools platforms;android-{SDK_VERSION} ndk;{NDK_VERSION}\", sdk_manager_path.display(), default_android_home.display()),\n          error,\n        })?;\n\n      if !status.success() {\n        crate::error::bail!(\"Failed to install Android SDK\");\n      }\n    }\n\n    std::env::set_var(\"ANDROID_HOME\", default_android_home);\n  }\n\n  Ok(())\n}\n\nfn ensure_ndk(non_interactive: bool) -> Result<()> {\n  // re-evaluate ANDROID_HOME\n  let android_home = std::env::var_os(\"ANDROID_HOME\")\n    .or_else(|| std::env::var_os(\"ANDROID_SDK_ROOT\"))\n    .map(PathBuf::from)\n    .context(\"Failed to locate Android SDK\")?;\n\n  // check NDK_HOME\n  let mut installed_ndks = if let Some(ndk_home) = std::env::var_os(\"NDK_HOME\") {","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/android/mod.rs#L564-L600","documentation":"The CLI successfully launched sdkmanager to install platform-tools, platforms;android-{SDK_VERSION} and ndk;{NDK_VERSION}, but the command exited with a non-zero status. The underlying sdkmanager output is printed above the error; typical causes are unaccepted licenses, network/proxy failures, disk space, or an incompatible/missing Java runtime.","triggerScenarios":"`sdkmanager --sdk_root=... --install platform-tools platforms;android-X ndk;Y` returning non-zero — e.g. licenses not accepted, HTTP 403/timeout behind a proxy, 'Could not determine java version', or insufficient disk space.","commonSituations":"Fresh CI machines that never ran `sdkmanager --licenses`; corporate proxies blocking dl.google.com; JAVA_HOME pointing to an unsupported JDK; full disk in Docker builds.","solutions":["Run the sdkmanager command printed in the error manually to see the full failure output","Accept licenses: `yes | sdkmanager --licenses` then rerun the tauri command","Fix network/proxy or Java issues (install JDK 17+, ensure JAVA_HOME is valid), free disk space, then retry","On CI, cache the SDK directory so the install step is skipped after the first run"],"exampleFix":"# before\nerror: Failed to install Android SDK\n# after\nyes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --licenses\ntauri android dev","handlingStrategy":"retry","validationCode":"# pre-accept licenses so sdkmanager cannot fail on them:\nyes | sdkmanager --licenses >/dev/null 2>&1\ndf -h \"$ANDROID_HOME\" | tail -1   # NDK/platform need ~2GB+ free","typeGuard":null,"tryCatchPattern":"#!/usr/bin/env bash\nfor i in 1 2 3; do\n  tauri android build --ci && exit 0\n  echo \"retry $i: sdkmanager install failed - check licenses/network\"\ndone\nexit 1","preventionTips":["Accept licenses (`yes | sdkmanager --licenses`) as an early CI step","Verify JDK 17+ and JAVA_HOME before building; sdkmanager dies on wrong Java","Reserve enough disk and cache the SDK directory in CI to avoid repeated downloads"],"tags":["android","sdk","sdkmanager","licenses","network","java"],"backgroundTag":"sdkmanager-install-failed","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}