-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Describe the bug
LDClient initialization throws an exception after r8 shrinking if full mode is enabled due to a missing generic type signature on which gson depends. Full mode is a proguard-incompatible mode that removes code which proguard does not for further shrinking benefit. It requires more explicit rules when shrinking happens. Ideally, gson would provide the required configuration via consumer proguard rule metadata in the maven package, but it doesn't appear to set that up. Since LaunchDarkly's SDK specifies some rules, updating them in this library's consumer pro guard rules seems reasonable and valuable.
To reproduce
Enable full mode via the android.enableR8.fullMode=true gradle property or use ≥ Android Gradle Plugin 8.0, which enables full mode by default.
Expected behavior
LDClient should initialize without crashing.
SDK version
4.2.1
Language version, developer tools
Kotlin 1.8
Android Gradle Plugin 8
Gradle 8.1.1
OS/platform
Android 33
Additional context
Here are the recommended rules according to the gson example: https://github.com/google/gson/blob/55cf9fa941e93030244ecc9092f65183c16fc745/examples/android-proguard-example/proguard.cfg#L28-L30