fix(desktop): unbreak release crash via correct ProGuard rules#5236
Merged
jamesarich merged 2 commits intoApr 23, 2026
Conversation
Per R8_Configuration_Analysis.md:
- Remove broad package-wide Compose keeps (androidx.compose.{runtime,ui,animation,foundation,material3}.**). The primary defence against CMP 1.11 optimizer folding is -dontoptimize; package-wide keeps are redundant and subsume library consumer rules. If animations freeze in future CMP releases, replace with class-level keeps on Composer/ComposerImpl/ComposeRuntimeFlags/ComposeStackTraceMode only.
- Remove qrcode-kotlin keeps (io.github.g0dkar.qrcode.** and qrcode.**). QRCode.ofSquares().build() is called statically throughout the codebase; no Class.forName or ServiceLoader reflection detected. R8 can resolve this without manual keeps.
- Consolidate keep rules into minimal targeted form per keep-rules-impact-hierarchy guidance. Inline all consumer rules in shared-rules.pro (desktop ProGuard does not auto-discover META-INF/proguard/*.pro as R8 does).
- Verified: Android release builds (assembleFdroidRelease) and desktop release (createReleaseDistributable) both succeed. Desktop binary launches without animation freeze.
Deferred: androidx.sqlite.driver.bundled.** JNI symbol enumeration (low priority; package-wide keep is not a size concern).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9ce0b4b to
904ad1c
Compare
The previous group-wide eachDependency rule pinned every artifact in the `androidx.compose.material` group to 1.7.8, which actively downgraded `material-ripple` from CMP-aligned 1.11.0-rc01. Narrow the pin to the `:material` (M2 main) artifact only. M2 is needed because maps-compose-widgets (google flavor) requests it without a version relying on a BOM that we exclude. material-ripple now resolves to the CMP-aligned 1.11.0 line as JetBrains intends. Verified :app:assembleGoogleDebug, :app:assembleFdroidDebug, :desktop:assemble. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
904ad1c to
c1f4823
Compare
Copilot AI
pushed a commit
that referenced
this pull request
Apr 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Desktop release v2.7.14-internal.69 crashed on launch on macOS, Windows, and Linux arm64 .deb. Root cause: compose-jb's standalone ProGuard 7.7 task does not auto-discover
META-INF/proguard/*.proconsumer rules from dependency jars (only R8 on Android does — see Guardsquare/proguard#423). Reflective lookups (e.g. ktor'sKotlinxSerializationJsonExtensionProvidervia ServiceLoader) failed at runtime withServiceConfigurationError.This PR resets the rules to the JetBrains-recommended approach: a single static
shared-rules.prothat inlines every consumer rule we need on desktop. On Android, R8 still auto-discovers these from the jars, so the inlined copies are harmless duplicates.Changes
config/proguard/shared-rules.pro— inlines consumer rules from kotlinx-coroutines, kotlinx-serialization, kotlinx-datetime, ktor, androidx.annotation, androidx.datastore. Adds explicit-keepfor ktor'sKotlinxSerializationExtensionProviderimpls (consumer rule keeps the META-INF/services file but not the impl class). Removes broad Compose package keeps (-dontoptimizeis the real defence against fix(app): add R8 keep rules for Compose animation/runtime/ui #5146) and qrcode-kotlin keeps (statically called viaQRCode.ofSquares()— no reflection in our code). Preserves targeted keeps for Wire ADAPTER fields, Koin annotation source classes, the bundled SQLite JNI bridge, and our specific Room database.desktop/proguard-rules.pro— slimmed to JVM-specifics:-dontprocesskotlinmetadata(ProGuard 7.7 + Kotlin 2.3 NPE workaround),-dontoptimize, narrow-dontwarnlines for jSerialComm Android stubs, WireAndroidMessage, three specific VicoColorScale*classes, and Kotlin 2.3+ stdlib intrinsics not on JDK 17.desktop/build.gradle.kts— comment block clarifying that consumer rules must be inlined manually for desktop.Verification
./gradlew spotlessApply detekt✅./gradlew :app:assembleFdroidRelease✅ (Android R8)./gradlew :desktop:createReleaseDistributable✅Untested platforms
macOS, Windows, Linux arm64 .deb (no local hardware). Crash signature was platform-agnostic (ServiceLoader / reflective lookups), but please verify on at least one non-Linux runner before tagging the next release.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com