Skip to main content

ProGuard rules

When code obfuscation is enabled, add the following rules to your proguard-rules.pro file to prevent the Nexconn SDK classes from being obfuscated.

info

The Nexconn Chat SDK ships with a built-in consumer ProGuard configuration. The rules below are automatically applied when you add the SDK as a Gradle dependency. You only need to add them manually if the automatic rules are not picked up by your build.

Required rules

properties
# Keep all public and protected members in the SDK package
-keep class com.nexconn.chat.** {
public *;
protected *;
}

# Keep the bridge package (used internally by the RTC module)
-keep class com.nexconn.chat.bridge.** {
public *;
protected *;
}

# Keep enum values() and valueOf() methods
-keepclassmembers enum com.nexconn.chat.** {
public static **[] values();
public static ** valueOf(java.lang.String);
}

# Keep Kotlin data class component functions and copy()
-keepclassmembers class com.nexconn.chat.** {
public ** component*();
public ** copy(...);
}

# Keep NCError constants
-keepclassmembers class com.nexconn.chat.error.NCError {
public static final int *;
}

# Keep handler and callback interfaces
-keep interface com.nexconn.chat.handler.** { *; }

Custom message types

If you define custom message types by subclassing CustomMessageContent or CustomMediaMessageContent, add keep rules for each subclass. These classes are instantiated via reflection at runtime and will be stripped by ProGuard without an explicit rule.

properties
-keep class * extends com.nexconn.chat.message.CustomMessageContent { *; }
-keep class * extends com.nexconn.chat.message.CustomMediaMessageContent { *; }

Push plugins

The FCM and HMS push plugins each include their own built-in ProGuard rules and are automatically applied as consumer rules. If you need to add them manually:

properties
# FCM and HMS push plugins
-keep class !android.support.v7.internal.view.menu.**,** {*;}
-dontwarn
-ignorewarnings