nostr icon indicating copy to clipboard operation
nostr copied to clipboard

[Kotlin nostr] Include proguard rules

Open dluvian opened this issue 1 year ago • 2 comments
trafficstars

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

dluvian avatar Apr 12 '24 09:04 dluvian

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

yukibtc avatar Apr 12 '24 12:04 yukibtc

Yeah, I have no idea how to set this up correctly...

dluvian avatar Apr 13 '24 04:04 dluvian