-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pro guard optimize flag #3408
Conversation
@@ -12,7 +12,7 @@ import org.jetbrains.compose.internal.utils.notNullProperty | |||
import org.jetbrains.compose.internal.utils.nullableProperty | |||
import javax.inject.Inject | |||
|
|||
private const val DEFAULT_PROGUARD_VERSION = "7.2.2" | |||
private const val DEFAULT_PROGUARD_VERSION = "7.3.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I locallly switched to this version, I encountered other crashes. CI seems also can't build it.
It seeems switching to this version isn't easy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I locallly switched to this version, I encountered other crashes. CI seems also can't build it.
It seeems switching to this version isn't easy.
Fixed with:
-keep class androidx.compose.runtime.** { *; }
-keep class kotlinx.coroutines.** { *; }
This will exclude Kotlinx coroutines from minimization. The bundle size will be 29.4 MB for the example desktop app on the macOS Apple silicon uber JAR file, previously 28.3 MB with the runtime error.
Tested with Compose 1.6.10, Proguard 7.5.0, and Kotlin 2.0.0 with a project created by kmp.jetbrains.com
The Kotlinx coroutines' Proguard rules seem to be a bit outdated, I couldn't get it working with Proguard without ignoring the warnings from kotlix.coroutines
on blank Kotlin/JVM project on latest version of Proguard (7.5.0) and Kotlin (2.0.0)
I suggest excluding it from minimization to not have unexpected runtime errors for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also lifting the default to 7.5.0 seems to be a must because it is the only version which is compatible with Kotlin 2.0.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have my own projects running that way already. My comment was meant as a hint to Jetbrains because at the moment building desktop applications with Kotlin 2.0.0 is broken by default.
327bcaf
to
ff5da4a
Compare
ProGuard's optimizations are enabled by default. To disable them, set the following property via Gradle DSL: