{"record":{"id":"bb60cdc06d2c63cc","repo":"tauri-apps/tauri","slug":"failed-to-write-proguard-tauri-pro","errorCode":null,"errorMessage":"failed to write proguard-tauri.pro","messagePattern":"failed to write proguard-tauri\\.pro","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri/build.rs","lineNumber":333,"sourceCode":"\n        let out_path = kotlin_out_dir.join(file.file_name());\n        // Overwrite only if changed to not trigger rebuilds\n        write_if_changed(&out_path, &content).expect(\"Failed to write kotlin file\");\n\n        println!(\"cargo:rerun-if-changed={}\", out_path.display());\n      }\n    }\n\n    if let Some(project_dir) = env::var_os(\"TAURI_ANDROID_PROJECT_PATH\").map(PathBuf::from) {\n      let package_unescaped = env::var(\"TAURI_ANDROID_PACKAGE_UNESCAPED\")\n        .unwrap_or_else(|_| env_var(\"WRY_ANDROID_PACKAGE\").replace('`', \"\"));\n      let tauri_proguard =\n        include_str!(\"./mobile/proguard-tauri.pro\").replace(\"$PACKAGE\", &package_unescaped);\n      std::fs::write(\n        project_dir.join(\"app\").join(\"proguard-tauri.pro\"),\n        tauri_proguard,\n      )\n      .expect(\"failed to write proguard-tauri.pro\");\n    }\n\n    let lib_path =\n      PathBuf::from(std::env::var_os(\"CARGO_MANIFEST_DIR\").unwrap()).join(\"mobile/android\");\n    println!(\"cargo:android_library_path={}\", lib_path.display());\n  }\n\n  #[cfg(target_os = \"macos\")]\n  {\n    if target_os == \"ios\" {\n      let lib_path =\n        PathBuf::from(std::env::var_os(\"CARGO_MANIFEST_DIR\").unwrap()).join(\"mobile/ios-api\");\n      tauri_utils::build::link_apple_library(\"Tauri\", &lib_path);\n      println!(\"cargo:ios_library_path={}\", lib_path.display());\n    }\n  }\n\n  let tauri_global_scripts = PathBuf::from(\"./scripts/bundle.global.js\")","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri/build.rs#L315-L351","documentation":"When TAURI_ANDROID_PROJECT_PATH is set, tauri's build script renders mobile/proguard-tauri.pro with the app's package name and writes it to <project>/app/proguard-tauri.pro. The expect fires when the write fails, typically because <project>/app does not exist or the directory is not writable.","triggerScenarios":"TAURI_ANDROID_PROJECT_PATH pointing at a folder without an app/ subdirectory (deleted or never generated), or a read-only Android project directory.","commonSituations":"Android project folder pruned or only partly regenerated; env var pointing at the wrong directory; permission problems in CI.","solutions":["Ensure <TAURI_ANDROID_PROJECT_PATH>/app exists; re-run tauri android init if unsure.","Fix TAURI_ANDROID_PROJECT_PATH to the actual gen/android path.","Make the Android project directory writable."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if let Some(project) = std::env::var_os(\"TAURI_ANDROID_PROJECT_PATH\") {\n    let app_dir = std::path::PathBuf::from(project).join(\"app\");\n    assert!(app_dir.is_dir(), \"{} is missing - run tauri android init\", app_dir.display());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run tauri android init whenever the Android project is regenerated.","Verify the env var points at the gen/android folder that actually contains app/."],"tags":["tauri","android","build-script","proguard"],"backgroundTag":"build-script-write-failed","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","contentChangedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}