From cb87cfd926dc6d16df8c3c6cf1b521ae1f90392d Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 12 Sep 2024 22:28:01 -0300 Subject: [PATCH] fix(core): prevent Proguard from optimizing away custom ser/de classes Fixes a couple bugs in the clipboard plugin on release builds: - custom serializer class constructor being optimized away - deserializer inner class constructor being optimized away --- .changes/fix-android-proguard.md | 5 +++++ crates/tauri/mobile/android/proguard-rules.pro | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .changes/fix-android-proguard.md diff --git a/.changes/fix-android-proguard.md b/.changes/fix-android-proguard.md new file mode 100644 index 000000000000..f6e7dafae501 --- /dev/null +++ b/.changes/fix-android-proguard.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:bug +--- + +Add a Proguard rule to prevent custom JSON deserializer and serializer classes from being optimized away. diff --git a/crates/tauri/mobile/android/proguard-rules.pro b/crates/tauri/mobile/android/proguard-rules.pro index ab44933621d1..e21b5beb4693 100644 --- a/crates/tauri/mobile/android/proguard-rules.pro +++ b/crates/tauri/mobile/android/proguard-rules.pro @@ -28,4 +28,14 @@ *; } +-keep @com.fasterxml.jackson.databind.annotation.JsonDeserialize public class * { + *; +} + +-keep @com.fasterxml.jackson.databind.annotation.JsonSerialize public class * { + *; +} + -keep class * extends com.fasterxml.jackson.databind.JsonDeserializer { *; } + +-keep class * extends com.fasterxml.jackson.databind.JsonSerializer { *; }