diff --git a/.changes/android-proguard.md b/.changes/android-proguard.md new file mode 100644 index 000000000000..d9914873e766 --- /dev/null +++ b/.changes/android-proguard.md @@ -0,0 +1,7 @@ +--- +"tauri": "patch:bug" +"tauri-cli": "patch:bug" +"@tauri-apps/cli": "patch:bug" +--- + +Fix android invalid proguard file when using an `identifier` that contains a component that is a reserved kotlin keyword, like `in`, `class`, etc diff --git a/crates/tauri-cli/src/mobile/android/mod.rs b/crates/tauri-cli/src/mobile/android/mod.rs index 1866c8ab9700..c1d8e0e4afd7 100644 --- a/crates/tauri-cli/src/mobile/android/mod.rs +++ b/crates/tauri-cli/src/mobile/android/mod.rs @@ -139,6 +139,7 @@ pub fn get_config( "WRY_ANDROID_PACKAGE", app.android_identifier_escape_kotlin_keyword(), ); + set_var("WRY_ANDROID_PACKAGE_NO_ESCAPE", app.identifier()); set_var("WRY_ANDROID_LIBRARY", app.lib_name()); set_var("TAURI_ANDROID_PROJECT_PATH", config.project_dir()); diff --git a/crates/tauri/build.rs b/crates/tauri/build.rs index 6d51bdecf0ca..36935809649e 100644 --- a/crates/tauri/build.rs +++ b/crates/tauri/build.rs @@ -301,8 +301,8 @@ fn main() { if let Some(project_dir) = env::var_os("TAURI_ANDROID_PROJECT_PATH").map(PathBuf::from) { let tauri_proguard = include_str!("./mobile/proguard-tauri.pro").replace( "$PACKAGE", - &env::var("WRY_ANDROID_PACKAGE") - .expect("missing `WRY_ANDROID_PACKAGE` environment variable"), + &env::var("WRY_ANDROID_PACKAGE_NO_ESCAPE") + .expect("missing `WRY_ANDROID_PACKAGE_NO_ESCAPE` environment variable"), ); std::fs::write( project_dir.join("app").join("proguard-tauri.pro"),