https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
p

powerful-electrician-46685

04/04/2023, 3:06 PM
Hello, I am working on integrating our Android app with the Java SDK. Our Debug app allows users to switch between Production and Staging environments for testing purposes. Setting it up went smoothly for the debug app, but our Release app (only containing production environment) continues to return null "default values" from the GrowthBook sdk instance. After debugging, I see the featuresJson String correctly being returned from the web and applied to the GrowthBook sdk context, but feature flags continue to return null. Anybody have any ideas why the SDK would be returning default values of null for flags that hold a value according the features json string?
b

better-magician-65629

04/04/2023, 5:41 PM
what is the value type of the feature you're trying to return? my immediate thought is potentially something to do with proguard. are you able to test a production release without proguard enabled to see if the issue still occurs?
p

powerful-electrician-46685

04/04/2023, 5:55 PM
I tested this thought out on our Debug app. Turned progaurd on but it still worked correctly. I'll test out disabling proguard on the Production app when I am back from lunch shortly and let you know
Aha, it does work when I disable R8 on Product release. Is there any documentation on ProGuard rules that need to be added?
b

better-magician-65629

04/04/2023, 6:44 PM
awesome, well i'm glad we got closer to figuring it out. we don't have any docs on which specific classes to keep right now, but i'd go with keeping all the classes just to be safe. also, if your value types are serialized and deserialized via the SDK, those classes should be kept as well. can you let me know if that works and what your proguard file looks like? i can add it to the docs in the future. also you're welcome to contribute that to the docs as well if you'd like.
can you confirm the class type of the feature value type? is it a gson serializable/deserializable class? these are the publicly-facing classes: https://growthbook.github.io/growthbook-sdk-java/growthbook/sdk/java/package-summary.html
p

powerful-electrician-46685

04/04/2023, 6:46 PM
Will do, I'll try adding a rule to cover growthbook and get back to you with results
🙌 1
Value type of the features I had been testing were just Boolean so far.
👍 1
b

better-magician-65629

04/04/2023, 6:52 PM
thanks for confirming the value type.
p

powerful-electrician-46685

04/04/2023, 6:52 PM
thanks for the help!
Adding this rule to proguard-rules.pro fixes this issue.
Copy code
# Growthbook Java SDK classes
-keep class growthbook.sdk.java.** { *; }
Thanks for the direction! I was thinking this was the issue, but I kept thinking I already ruled it out. Really appreciate it!
b

better-magician-65629

04/04/2023, 7:04 PM
🙌 awesome! thanks for confirming. i will add this to our docs
1
15 Views