nostr
nostr copied to clipboard
[Kotlin nostr] Include proguard rules
Describe the enhancement
Include proguard rules that will allow users to build their Android app in release mode with minify enabled.
Use case
As an Android dev you usually set isMinifyEnabled = true in your build options to reduce the apk size but doing so will break the app. Some classes should be excluded from the minify process or rust-nostr will not work. It would be nice if the lib would work from the get-go without having to figure out proguard rules.
Additional context
I don't know if this is the best solution but it works for me and it's what I'm currently using:
-keep class com.sun.jna.** { *; }
-keep class * implements com.sun.jna.** { *; }
-dontwarn java.awt.Component
-dontwarn java.awt.GraphicsEnvironment
-dontwarn java.awt.HeadlessException
-dontwarn java.awt.Window
Here the file: https://github.com/dluvian/voyage/blob/master/app/proguard-rules.pro
Those rules are already included here: https://github.com/rust-nostr/nostr/blob/master/bindings/nostr-sdk-ffi/bindings-android/lib/proguard-rules.pro
Not sure if I have to do something else. Are also included in the buildTypes.release: https://github.com/rust-nostr/nostr/blob/master/bindings/nostr-sdk-ffi/bindings-android/lib/build.gradle.kts#L30
Yeah, I have no idea how to set this up correctly...