{"record":{"id":"a93b087437318796","repo":"tauri-apps/tauri","slug":"android-folder-already-exists","errorCode":null,"errorMessage":"Android folder already exists","messagePattern":"Android folder already exists","errorType":"validation","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/plugin/android.rs","lineNumber":62,"sourceCode":"  /// The output directory.\n  #[clap(short, long)]\n  #[clap(default_value_t = current_dir().expect(\"failed to read cwd\").to_string_lossy().into_owned())]\n  out_dir: String,\n}\n\npub fn command(cli: Cli) -> Result<()> {\n  match cli.command {\n    Commands::Init(options) => {\n      let plugin_name = match options.plugin_name {\n        None => super::infer_plugin_name(\n          std::env::current_dir().context(\"failed to get current directory\")?,\n        )?,\n        Some(name) => name,\n      };\n\n      let out_dir = PathBuf::from(options.out_dir);\n      if out_dir.join(\"android\").exists() {\n        crate::error::bail!(\"Android folder already exists\");\n      }\n\n      let plugin_id = prompts::input(\n        \"What should be the Android Package ID for your plugin?\",\n        Some(format!(\"com.plugin.{plugin_name}\")),\n        false,\n        false,\n      )?\n      .unwrap();\n\n      let handlebars = Handlebars::new();\n\n      let mut data = BTreeMap::new();\n      super::init::plugin_name_data(&mut data, &plugin_name);\n      data.insert(\"android_package_id\", handlebars::to_json(&plugin_id));\n\n      let mut created_dirs = Vec::new();\n      template::render_with_generator(","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/plugin/android.rs#L44-L80","documentation":"`tauri plugin android init` refuses to overwrite existing output: before scaffolding the plugin's Android Kotlin sources it checks for an `android` directory inside the chosen output dir and bails if one exists, to protect manual changes you may have made.","triggerScenarios":"Running `tauri plugin android init` (with default or explicit `--out-dir`) in a plugin crate that already contains an `android/` folder — i.e. init was already run once, or an unrelated folder named android exists there.","commonSituations":"Re-running init to 'refresh' a plugin template; CI automation that runs init on every build; picking an out-dir that already contains android sources from another plugin.","solutions":["If you truly want a fresh scaffold, delete or move the existing `android/` folder first.","Otherwise skip init — the plugin already has its Android sources.","Use `--out-dir` to scaffold into a different location.","Commit or back up manual changes inside android/ before deleting it."],"exampleFix":"# before\ntauri plugin android init\n# error: Android folder already exists\n\n# after\nmv android android.bak   # or rm -rf android\ntauri plugin android init","handlingStrategy":"validation","validationCode":"test ! -e android \\\n  && tauri plugin android init \\\n  || echo \"android/ already scaffolded - skipping init\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make plugin scaffolding idempotent in CI: skip init when the folder exists.","Never point --out-dir at a directory shared with other plugins."],"tags":["tauri-cli","plugin","android","init","scaffold"],"backgroundTag":"output-directory-exists","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}