Open jzbrooks opened 1 year ago
Hello, @jzbrooks, thank you for reaching out, we will look into this and see if can we implement your suggestion.
Filed internally as 199469.
Any news?
The solution for now is to add those rules into proguard-rules.pro
:
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
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