Skip to content

Fix Google Sign-In deserialization crash on desktop targets under ProGuard (#16)#17

Merged
sunildhiman90 merged 1 commit into
mainfrom
fix/google-signin-jvm-deserialization
Jun 28, 2026
Merged

Fix Google Sign-In deserialization crash on desktop targets under ProGuard (#16)#17
sunildhiman90 merged 1 commit into
mainfrom
fix/google-signin-jvm-deserialization

Conversation

@sunildhiman90

Copy link
Copy Markdown
Owner

Resolves #16

Cause of the Crash

When packaging a Compose Multiplatform desktop application for distribution (e.g., as .msi, .dmg, or .deb), ProGuard runs by default on the JVM target to shrink the bundle size and optimize code.

In GoogleAuthManagerJvm, the library was using Gson to deserialize the Google user info JSON response into a private nested data class: GoogleAuthManagerJvm.GoogleUser. Since Gson relies on runtime reflection, it fails in a shrunken/obfuscated environment because ProGuard strips/renames the fields and constructors of private classes, leading to the reported RuntimeException.

Solution

  • Switched from Gson to Kotlinx Serialization for parsing the user info response.
  • Deleted the redundant, reflection-based private nested GoogleUser class and reused the shared @Serializable GoogleUser data class from commonMain.
  • Since kotlinx.serialization uses compile-time generated serializers rather than runtime JVM reflection, it is fully compatible with ProGuard/R8 out of the box.
  • Bumped the library version to 0.3.8.

@sunildhiman90
sunildhiman90 merged commit 68fcf79 into main Jun 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KMAuth desktop compiled app unable to create GoogleUser on callback

1 participant