在使用 RTC SDK for Android 时,如何进行混淆配置?
根据接入的 RTC SDK 版本不同,在混淆文件里面增加对应内容:
-keepclasseswithmembernames class * {
native <methods>;
}
# 保证CalledByNative不被混淆
-keep @org.webrtc.CalledByNative class *
# 保持webrtc、RtcEngine中的类不被混淆
-keep class org.webrtc.**{*;}
-keep class com.bytedance.services.** {*;}
-keep class com.bytedance.webrtc.** {*;}
-keep class com.bytedance.realx.** {*;}
-keep class com.bytedance.bae.** {*;}
-keep class com.ss.bytertc.**{*;}
# 保证所有带有带有CallByNaitve注解方法与类名称不被混淆
-keepclasseswithmembers class * {
@org.webrtc.CalledByNative *;
}
-keepclasseswithmembers class * {
@com.bytedance.bae.base.CalledByNative *;
}
-keepattributes Signature
-keepattributes *Annotation*
# 避免在 R8 混淆时,warning 信息被当做 error 处理
-dontwarn com.ss.android.ugc.effectmanager.**
-dontwarn com.apm.lite.**
-dontwarn com.huawei.**
# 保证智能美化特效(CV) SDK 不被混淆
## 使用 v4.4.3+ 版本 CV SDK 时的配置:
-keep class com.effectsar.labcv.effectsdk.** {;}
-keep class com.bef.effectsdk.* {;}
-keep class com.effectsar.labcv.licenselibrary.* {*;}
## 使用 v4.4.2 及以前版本 CV SDK 时的配置:
-keep class com.bytedance.labcv.effectsdk.** {;}
-keep class com.bef.effectsdk.* {;}
-keep class com.bytedance.labcv.licenselibrary.* {*;}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keepclasseswithmembernames class * {
native <methods>;
}
# 保证CalledByNative不被混淆
-keep @org.webrtc.CalledByNative class *
# 保持webrtc、RtcEngine中的类不被混淆
-keep class org.webrtc.**{*;}
-keep class com.bytedance.**{*;}
-keep class com.ss.bytertc.**{*;}
# 保证所有带有带有CallByNaitve注解方法与类名称不被混淆
-keepclasseswithmembers class * {
@org.webrtc.CalledByNative *;
}
-keepclasseswithmembers class * {
@com.bytedance.bae.base.CalledByNative *;
}
-keepattributes Signature
-keepattributes *Annotation*
# 避免在 R8 混淆时,warning 信息被当做 error 处理
-dontwarn com.ss.android.ugc.effectmanager.**
-dontwarn com.apm.lite.**
-dontwarn com.huawei.**