diff --git a/tuta-sdk/android/sdk/build.gradle.kts b/tuta-sdk/android/sdk/build.gradle.kts index dc70736cc9f5..cff21e1336da 100644 --- a/tuta-sdk/android/sdk/build.gradle.kts +++ b/tuta-sdk/android/sdk/build.gradle.kts @@ -63,8 +63,10 @@ android { isJniDebuggable = true } release { - isMinifyEnabled = true - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + // Do not apply minification to the library artifact itself, without the application code that references + // the specific classes we cannot know what we need to keep so we would have to effectively disable + // minification anyway. + isMinifyEnabled = false } create("releaseTest") { initWith(getByName("release")) diff --git a/tuta-sdk/android/sdk/consumer-rules.pro b/tuta-sdk/android/sdk/consumer-rules.pro index 9d33c0105b9f..6d1f003b2220 100644 --- a/tuta-sdk/android/sdk/consumer-rules.pro +++ b/tuta-sdk/android/sdk/consumer-rules.pro @@ -2,11 +2,24 @@ # See https://developer.android.com/build/shrink-code#configuration-files # See https://developer.android.com/studio/projects/android-library#Considerations -# Keep generated SDK types. A lot of them are accessed using JNA or are part of generated entities. --keep class de.tutao.tutasdk.** +# The rule below would keep all the generated classes. This is currently not necessary as shrinker should find the +# referenced classes and their methods from what is actually used by the application code. If that doesn't work it's +# probably misconfiguration on the app's side. +# This might change in the future if we reference the types in a more dynamic way but currently the graph can be +# traversed statically. +#-keep class de.tutao.tutasdk.** { +# *; +#} + # Some AWT things are referenced by JNA for some reason. But we really, really don't use AWT. -dontwarn java.awt.* -# JNA is needed for uniffi and some things are resolved dynamically when called from native. --keep class com.sun.jna.** --keep class * extends com.sun.jna.** --keep class * implements com.sun.jna.** \ No newline at end of file +# JNA is needed for uniffi and some private static methods on it are called from native. +-keep class com.sun.jna.** { + *; +} +-keep class * extends com.sun.jna.** { + *; +} +-keep class * implements com.sun.jna.** { + *; +} \ No newline at end of file diff --git a/tuta-sdk/android/sdk/proguard-rules.pro b/tuta-sdk/android/sdk/proguard-rules.pro deleted file mode 100644 index f65dd45166e3..000000000000 --- a/tuta-sdk/android/sdk/proguard-rules.pro +++ /dev/null @@ -1,11 +0,0 @@ -# These rules will be applied when the library is imported as a module. -# See https://developer.android.com/studio/projects/android-library#Considerations - -# Keep generated SDK types. A lot of them are accessed using JNA or are part of generated entities. --keep class de.tutao.tutasdk.** -# Some AWT things are referenced by JNA for some reason. But we really, really don't use AWT. --dontwarn java.awt.* -# JNA is needed for uniffi and some things are resolved dynamically when called from native. --keep class com.sun.jna.** --keep class * extends com.sun.jna.** --keep class * implements com.sun.jna.** \ No newline at end of file