Closed MarcosAlvesTJr closed 5 months ago
Thanks for reporting, we will take a look at this soon. It sounds like a problem with proguard or other code optimizer.
@MarcosAlvesTJr Can you provide us with some more details about your setup, in particular: Java version, Android gradle version, React native version, Android compile sdk version, any relevant code in the android/build.gradle and android/app/build.gradle files, any relevant rules defined in the proguard files. Additionally, can you reproduce this issue in the example app in this repo?
@kennyklaviyo
-keep class com.swmansion.reanimated.** { *; }
-keep class com.facebook.react.turbomodule.** { *; }
-keep class com.shopify.reactnative.skia.** { *; }
I wasn't able to reproduce the issue using the example app, it works as expected. Could it be a Java version problem?
I have limited knowledge of exactly how shrinkers work, but I do think it has to be the culprit. We make production builds with proguard enabled in our internal testing apps, and don't encounter this error. Even when I remove all com.klaviyo.
imports from the kotlin code.
Can you try adding a proguard rule for the Klaviyo SDK. Obviously since I couldn't reproduce, I can't verify this, but I think this is the correct syntax:
-keep class com.klaviyo.analytics.** { *; }
Appreciate you helping us diagnose the issue!
Are you using the native integration path (e.g. initializing from kotlin code) or purely react native? I've tested both ways but just curious your setup.
Hey good news, I did (sort of) reproduce the error in our test app. It was a different error message (maybe that has something to do with using different Java and/or React versions) but same root cause I suspect.
In my case, it crashed upon trying to create an event. The error was a null pointer exception due to a missing class. Adding the proguard rule I recommended fixed the crash. Please report back if it fixes it for you too!
@evan-masseau I'm using only React Native integration. I added the proguard rule and it works now, thanks a lot!
Glad to hear it! Thanks for your help here, this was informative for us as well. We'll add docs and also try to put in consumer proguard config for the future.
Checklist
master
branch or latest release of this package.Description
Expected behavior
Actual behavior
The Klaviyo React Native SDK version information
0.2.1 and 0.3.0
Environment Description
Android version 12. Devices: Samsung Galaxy A21 S, Xiaomi Redmi Note 10