0

I am using Sendbird SDK to implement chat functionality in Android app. In debug mode everything works fine, however once I create a release build with minifyEnabled = true to obfuscate the code using R8, although most of the chat functionality works fine, weirdly enough sending an image does not work - it throws an error that seems to be caused by code obfuscation when I make a call to Sendbird SDK's sendFileMessage method

Full error below:

Function ‘onFileMessageSent’ (JVM signature: onFileMessageSent(Lcom/sendbird/android/message/BaseFileMessage;Lcom/sendbird/android/exception/SendbirdException;Z)V) not resolved in class com.sendbird.android.internal.message.MessageManagerImpl$FileMessageSentHandler: public final fun onFileMessageSent(message: com.sendbird.android.message.BaseFileMessage, e: com.sendbird.android.exception.SendbirdException?, fromFallbackApi: kotlin.Boolean): mg.q defined in com.sendbird.android.internal.message.MessageManagerlmpl.FileMessageSentHandler | onFileMessageSent(Lcom/sendbird/android/message/BaseFileMessage;Lcom/sendbird/android/exception/SendbirdException;Z)Lmg/q;

As I am not familiar with Proguard/R8, I'm having a hard time trying to set a rule so that it does not obfuscate the methods mention above, but so far without success :(

By the way, the only proguard rule Sendbird asked us to set is this line:

-dontwarn com.sendbird.android.shadow.**

Refer to: https://sendbird.com/docs/chat/v4/android/getting-started/send-first-message#2-get-started-3-step-2-1-optional-%20configure-proguard-to-shrink-code-and-resources

After that, I tried to add the rules below in attempt to not obfuscate the whole sendbird SDK, but it still doesn't fix the error:

-keep class com.sendbird.** { *; }
-keep interface com.sendbird.** { *; }
-keepclassmembers class com.sendbird.**

I have ran out of ideas at this point, please help.

Bruce
  • 2,357
  • 5
  • 29
  • 50

1 Answers1

0

Have the same problem after migrating to R8, Sendbird chat v. 4.9.2

This lines fixed the problem for me:

# SendBird chat
-dontwarn com.sendbird.android.**
-keep,allowoptimization,allowshrinking class com.sendbird.** { *; }

(allowoptimization,allowshrinking flags helps to shrink final ask size, while preserving class and method names)

mrfixit
  • 1
  • 1