Did anyone successfully use Proguard? I'm hitting ...
# compose-desktop
m
Did anyone successfully use Proguard? I'm hitting this issue: https://github.com/Guardsquare/proguard/issues/349 but turning off that optimization I get an ever more arcane issue. Am I doing something wrong?
1
a
I had similar issue, only fix for me was to add some exclusions to proguard config as mentioned here: https://github.com/JetBrains/compose-multiplatform/issues/3947
So you will have to find out which package to keep in your proguard config, in your case it may not be
androidx.compose.**
m
-keep class androidx.compose.runtime.** { *; }
did fix one of the issues, going through them one by one
😬 1
s
Yes, Ashampoo Photos uses ProGuard. I had some difficulties in the past. I ended up with something rather radical 😄
Copy code
-dontwarn !com.ashampoo.photos.**
-keep class !com.ashampoo.photos.** { *; }
In addition to that I only needed the special rules for Multiplatform Compose and KotlinX Serialization, but nothing more.
m
I saw that suggested somewhere but wanted to avoid it. Got my application to build and mostly run now but I'm at 200 lines in my proguard file... Only some issues remaining.
s
I need no obfuscation for the third parties that are all open source anyway. 🤷‍♂️
m
Yeah but the optimization / size decrease is always nice.
s
Ashampoo Photos is around 100 MB, including the JDK. I don’t think people care until you hit a GB or so. 🙂
m
My app is at 102MB now without Proguard, I'd like it double digit. 😄
s
One day I might give it a second try to see how much performance I might gain, but reading that you already have 200 lines and still problems sounds like some effort to pay. 👀
Ashampoo Photos for Android has a proper ProGuard config, because here size really matters, but it wasn’t so problematic like the desktop version.
m
Got it fully working eventually. App download size (after packaging / compressing / etc) went down from 100.0MB to 81.3MB.
s
Nice. Maybe you share your work one day as a Gist or so. 😄
m
If it helps anyone, here is my configuration: https://gist.github.com/Nohus/34c45bc81cde78530deadf09dc498f0d Obviously it includes rules for the particular libraries that needed them in my project, but should be a good reference.
👍 2