https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
m

Marcin Wisniowski

12/11/2023, 11:36 AM
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

Anders Carlsen

12/11/2023, 12:47 PM
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

Marcin Wisniowski

12/11/2023, 1:10 PM
-keep class androidx.compose.runtime.** { *; }
did fix one of the issues, going through them one by one
😬 1
s

Stefan Oltmann

12/11/2023, 3:38 PM
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

Marcin Wisniowski

12/11/2023, 3:40 PM
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

Stefan Oltmann

12/11/2023, 3:42 PM
I need no obfuscation for the third parties that are all open source anyway. 🤷‍♂️
m

Marcin Wisniowski

12/11/2023, 3:43 PM
Yeah but the optimization / size decrease is always nice.
s

Stefan Oltmann

12/11/2023, 3:45 PM
Ashampoo Photos is around 100 MB, including the JDK. I don’t think people care until you hit a GB or so. 🙂
m

Marcin Wisniowski

12/11/2023, 3:46 PM
My app is at 102MB now without Proguard, I'd like it double digit. 😄
s

Stefan Oltmann

12/11/2023, 3:46 PM
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

Marcin Wisniowski

12/11/2023, 7:40 PM
Got it fully working eventually. App download size (after packaging / compressing / etc) went down from 100.0MB to 81.3MB.
s

Stefan Oltmann

12/11/2023, 8:26 PM
Nice. Maybe you share your work one day as a Gist or so. 😄
m

Marcin Wisniowski

12/11/2023, 9:27 PM
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
3 Views