{"record":{"id":"9cce383278e6de58","repo":"tauri-apps/tauri","slug":"project-directory-doesn-t-exist-please-run","errorCode":null,"errorMessage":"{} project directory {} doesn't exist. Please run `tauri {} init` and try again.","messagePattern":"(.+?) project directory (.+?) doesn't exist\\. Please run `tauri (.+?) init` and try again\\.","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/mod.rs","lineNumber":479,"sourceCode":"            target: Some(target.into()),\n            ..Default::default()\n          },\n          &tauri_dir,\n        )\n        .expect(\"failed to resolve target directory\")\n    })\n}\n\n#[allow(unused_variables)]\nfn ensure_init(\n  tauri_config: &ConfigMetadata,\n  app: &App,\n  project_dir: PathBuf,\n  target: Target,\n  noninteractive: bool,\n) -> Result<()> {\n  if !project_dir.exists() {\n    crate::error::bail!(\n      \"{} project directory {} doesn't exist. Please run `tauri {} init` and try again.\",\n      target.ide_name(),\n      project_dir.display(),\n      target.command_name(),\n    )\n  }\n\n  let mut project_outdated_reasons = Vec::new();\n\n  match target {\n    Target::Android => {\n      let java_folder = project_dir\n        .join(\"app/src/main/java\")\n        .join(tauri_config.identifier.replace('.', \"/\").replace('-', \"_\"));\n      if java_folder.exists() {\n        #[cfg(unix)]\n        ensure_gradlew(&project_dir)?;\n      } else {","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/mod.rs#L461-L497","documentation":"`ensure_init` runs before every `tauri android/ios dev|build` and verifies that the generated mobile project directory exists (e.g. `src-tauri/gen/android` or `src-tauri/gen/ios`). If it is missing, the platform tooling cannot proceed and you are told to run the matching init command.","triggerScenarios":"Executing `tauri android dev`/`tauri ios build` (etc.) in a repo where `tauri android init` / `tauri ios init` was never run, or where `src-tauri/gen/` was deleted, never committed by a .gitignore (gen/android is typically ignored), or the command is run from the wrong working directory so the tauri config is not found.","commonSituations":"Fresh clone of a project whose `gen/` folder is gitignored; a teammate assuming gen output is committed; running the CLI outside the project root; CI jobs that skip init.","solutions":["Run `tauri android init` or `tauri ios init` from the project root (where the tauri config is).","If gen/ was deleted, re-run init — it regenerates the project.","Commit the generated project (Tauri recommends committing gen/ios; for android at least ensure CI runs init).","Verify the directory exists afterwards: `ls src-tauri/gen/android`."],"exampleFix":"# before\ntauri android dev\n# error: Android Studio project directory src-tauri/gen/android doesn't exist\n\n# after\ntauri android init\ntauri android dev","handlingStrategy":"validation","validationCode":"# Before dev/build, ensure the generated project exists\nfor plat in android ios; do\n  test -d \"src-tauri/gen/$plat\" || { echo \"missing gen/$plat - run: tauri $plat init\"; }\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `tauri ios init`/`tauri android init` as the first step after cloning on a new machine.","Decide as a team whether gen/ is committed, and make CI run init when it is not.","Always run tauri CLI commands from the directory containing the tauri config."],"tags":["tauri-cli","mobile","init","android","ios","project-setup"],"backgroundTag":"project-not-initialized","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}