configcat / android-sdk

ConfigCat SDK for Android. ConfigCat is a hosted feature flag service: https://configcat.com. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
https://configcat.com/docs/sdk-reference/android
MIT License
13 stars 3 forks source link

getAllValueDetailsAsync() returns 0 flags in R8 full mode #37

Closed alenjularic closed 1 year ago

alenjularic commented 1 year ago

Describe the bug

Calling methods getAllValueDetailsAsync() or getAllValueDetails() in release builds results in the following error: An error occurred while getting the detailed values. Returning an empty map. Debug builds work normally.

The issue is likely related to R8 full mode, which is on by default in Android Studio Flamingo 2022.2.1.

Adding the following line to ProGuard rules fixes the issue for me, but it isn't optimal: -keep class com.configcat.** { *; }

Or disabling the R8 full mode in gradle.properties also fixes the problem: android.enableR8.fullMode=false

To reproduce

Build a release app and call getAllValueDetailsAsync() or getAllValueDetails(), number of flags returned should be 0.

Expected behavior

Should return the actual number of flags available in ConfigCat dashboard.

Screenshots

Screenshot 2023-06-06 at 16 50 38

SDK version

Using SDK 33

Language/Framework version

Kotlin 1.8.21 Gradle plugin 8.0.2

novalisdenahi commented 1 year ago

Hi, @alenjularic! Thank you for the issue! I will check on the problem and let you know if we fixed the problem.

novalisdenahi commented 1 year ago

Hi, @alenjularic!

The new 8.2.2 release contains the fix. Let us know how it works for you.

alenjularic commented 1 year ago

@novalisdenahi on 8.2.2 all working ok, thanks for the quick fix!