tauri-apps/tauri · error
failed to write proguard-tauri.pro
Error message
failed to write proguard-tauri.pro
What it means
Build-script panic when std::fs::write cannot write the generated proguard-tauri.pro file into the Android project's app directory. This file carries Tauri's required ProGuard/R8 keep rules and is written whenever TAURI_ANDROID_PROJECT_PATH is set. Failure aborts the crate build.
Solutions
- Verify TAURI_ANDROID_PROJECT_PATH points at an existing Tauri Android project containing an app/ directory
- Check write permissions on <project>/app and fix with chown/chmod
- Regenerate the Android project (tauri android init) if the directory structure is broken
- Free disk space / confirm the volume is writable
Example fix
// before export TAURI_ANDROID_PROJECT_PATH=/stale/path/gen/android // after rm -rf /stale/path/gen/android tauri android init export TAURI_ANDROID_PROJECT_PATH=$PWD/gen/android
Defensive patterns
Strategy: validation
Validate before calling
let app_dir = std::path::Path::new(&project_dir).join("app");
assert!(app_dir.is_dir(), "TAURI_ANDROID_PROJECT_PATH/app missing: {}", app_dir.display());
let probe = app_dir.join(".write-test");
std::fs::write(&probe, b"").expect("app dir not writable");
let _ = std::fs::remove_file(&probe); Prevention
- Always run `tauri android init` before setting TAURI_ANDROID_PROJECT_PATH
- Re-init the Android project after major Tauri upgrades
- Close Android Studio during headless builds to avoid file locks
When it happens
Trigger: Running an Android build with TAURI_ANDROID_PROJECT_PATH set while <project>/app is missing, unwritable, or the path points somewhere that cannot hold the file (permissions, read-only FS, disk full).
Common situations: TAURI_ANDROID_PROJECT_PATH pointing at a stale, moved, or incorrectly initialized Tauri Android project; IDE (Android Studio) holding locks on files in the project; building with a user that lacks write access to the generated Android project.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- failed to read kotlin file as string
- Failed to write kotlin file
- failed to canonicalize global API script path
- failed to canonicalize tauri global API script path
- Failed to canonicalize `WRY_ANDROID_KOTLIN_FILES_OUT_DIR`…
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/bb60cdc06d2c63cc.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri/build.rs:327
let out_path = kotlin_out_dir.join(file.file_name());
// Overwrite only if changed to not trigger rebuilds
write_if_changed(&out_path, &content).expect("Failed to write kotlin file");
println!("cargo:rerun-if-changed={}", out_path.display());
}
}
if let Some(project_dir) = env::var_os("TAURI_ANDROID_PROJECT_PATH").map(PathBuf::from) {
let package_unescaped = env::var("TAURI_ANDROID_PACKAGE_UNESCAPED")
.unwrap_or_else(|_| env_var("WRY_ANDROID_PACKAGE").replace('`', ""));
let tauri_proguard =
include_str!("./mobile/proguard-tauri.pro").replace("$PACKAGE", &package_unescaped);
std::fs::write(
project_dir.join("app").join("proguard-tauri.pro"),
tauri_proguard,
)
.expect("failed to write proguard-tauri.pro");
}
let lib_path =
PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("mobile/android");
println!("cargo:android_library_path={}", lib_path.display());
}
#[cfg(target_os = "macos")]
{
if target_os == "ios" {
let lib_path =
PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("mobile/ios-api");
tauri_utils::build::link_apple_library("Tauri", &lib_path);
println!("cargo:ios_library_path={}", lib_path.display());
}
}
let tauri_global_scripts = PathBuf::from("./scripts/bundle.global.js")View on GitHub (pinned to 460ec35447)