Closed rayliverified closed 1 year ago
Hi @searchy2 ,
We're currently investigating the issue. Can you share your proguard obfuscation setup?
The issue appears to be similar to https://stackoverflow.com/a/20651744/1237023 but we include enum
protections in our consumer proguard file. Can you also share your build/outputs/mapping/release/configuration.txt
file as well?
Ah, ProGuard strikes again!! KK, will share tomorrow. Likely the culprit
Hi @searchy2,
Are you still experiencing issues? Feel free to link more info here or contact support@braze.com directly with more details. Thanks!
I've reverted to v2.3.0 for now. Can you share the proper ProGuard setup for Braze?
The SDK is bundled with consumer proguard rules that should automatically be applied to your own proguard config. We can debug better once we have the files I listed above.
-keepattributes *Annotation*
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
# And if you use AsyncExecutor:
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
<init>(java.lang.Throwable);
}
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
##---------------End: proguard configuration for Gson ----------
# Iterable
-keep class org.json.** { *; }
# AppsFlyer
-keep class com.appsflyer.** { *; }
# Webview
-keep class com.flutter_webview_plugin.** { *; }
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
# Custom Adapters
-keep class com.treatmyocd.nocd.** { *; }
Can you post your build/outputs/mapping/release/configuration.txt
? You should see something in there like
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
You can add those rules directly to your proguard rules, or use the default proguard-android.txt in your rules with the following line in your build.gradle
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
I'm closing out this thread due to inactivity. If you still are running into issues, please reopen this thread or contact support@braze.com for a more detailed investigation.
Thank you!
The new SDK version crashes. SDK version: v2.4.0
We're a Braze customer (NOCD).