接入文档

配置流程

最近更新时间:2020-08-14 10:07:45

接入配置

注意事项

  • 人脸核身 SDK(WbCloudFaceLiveSdk)最低支持到 Android API 14: Android 4.0(ICS),请在构建项目时注意。
  • 人脸核身 SDK 将以 AAR 文件的形式提供,默认黑色皮肤,无需格外设置。
  • 人脸核身 SDK 同时需要依赖云公共组件 WbCloudNormal,同样也是以 AAR 文件的形式提供。
  • 需要为人脸核身 SDK 添加依赖,方式如下:
    将提供的 AAR 文件加入到 App 工程的 libs 文件夹下,并且在 build.gradle 中添加下面的配置。
android{
     //...
     repositories {
        flatDir {
            dirs 'libs' //this way we can find the .aar file in libs folder
        }
    }
}
//添加依赖
dependencies {
     //0. appcompat-v7
 compile 'com.android.support:appcompat-v7:23.0.1'
 //1. 云刷脸SDK
 compile(name: 'WbCloudFaceLiveSdk-版本号-githash值', ext: 'aar')
 //2. 云normal SDK
 compile(name: 'WbCloudNormal-版本号-githash值', ext: 'aar')
}
    }

混淆配置

云刷脸产品的混淆规则分为三部分,分别是云刷脸 SDK 的混淆规则、云公共组件的混淆规则以及依赖的第三方库混淆规则。

云刷脸 SDK 的混淆规则

您可以将如下代码拷贝到您的混淆文件中,也可以将 SDK 中的webank-cloud-face-light-proguard-rules.pro拷贝到主工程根目录下,然后通过-include webank-cloud-face-light-rules.pro加入到您的混淆文件中。

######################云刷脸混淆规则 faceverify-BEGIN###########################
#不混淆内部类
-keepattributes InnerClasses

-keep public class com.webank.facelight.tools.WbCloudFaceVerifySdk{
    public <methods>;
    public static final *;
}
-keep public class com.webank.facelight.tools.WbCloudFaceVerifySdk$*{
    *;
}
-keep public class com.webank.record.**{
    public <methods>;
    public static final *;
}
-keep public class com.webank.facelight.ui.FaceVerifyStatus{

}
-keep public class com.webank.facelight.ui.FaceVerifyStatus$Mode{
    *;
}
-keep public class com.webank.facelight.tools.IdentifyCardValidate{
    public <methods>;
}

-keep public class com.webank.facelight.contants.**{
    *;
}
-keep public class com.webank.facelight.listerners.**{
    *;
}
-keep public class com.webank.facelight.Request.*$*{
    *;
}
-keep public class com.webank.facelight.Request.*{
    *;
}
-keep public class com.webank.facelight.config.FaceVerifyConfig {
    public <methods>;
}

#================权限库混淆================
-keeppackagenames com.webank.mbank.permission_request


#================模拟器检测混淆规则===========================
-keep public class com.webank.mbank.securecheck.CheckCallback{
    *;
}

-keep public class com.webank.mbank.securecheck.EmulatorCheck{
    public <methods>;
}

#================数据上报混淆规则 start===========================
#实体类
-keep class com.webank.facelight.wbanalytics.EventSender{
    *;
}
-keep class com.webank.facelight.wbanalytics.EventSender$*{
    *;
}
-keep class com.webank.facelight.wbanalytics.WBAEvent{
    *;
}

#---------对外接口---------
-keep class com.webank.facelight.wbanalytics.WBAnalyticsService{
    public <methods>;
}
-keepparameternames

#其他配置类
-keep class com.webank.facelight.wbanalytics.WBAnalyticsConfig{
    public <methods>;
}
#异常类型
-keep class com.webank.facelight.wbanalytics.WBASDKException

#================数据上报混淆规则 end===========================

-keep class com.tencent.youtuface.**{
    *;
}

-keep class com.tencent.youtulivecheck.**{
    *;
}

-keep class com.tencent.youtufacetrack.**{
    *;
}

-keep class com.tencent.youtufacelive.model.**{
    *;
}

-keep class com.tencent.youtufacelive.tools.FileUtils{
    public <methods>;
}

-keep class com.tencent.youtufacelive.tools.YTUtils{
    public <methods>;
}
-keep class com.tencent.youtufacelive.tools.YTCountDownTimer{
    public <methods>;
}
-keep class com.tencent.youtufacelive.tools.YTFaceLiveLogger{
    public <methods>;
}

-keep class com.tencent.youtufacelive.tools.YTFaceLiveLogger$IFaceLiveLogger{
     *;
}

-keep class com.tencent.youtufacelive.listeners.**{
    *;
}

-keep class com.tencent.youtufacelive.YTPreviewHandlerThread{
    public static *;
    public <methods>;
}

-keep class com.tencent.youtufacelive.YTPreviewHandlerThread$IUploadListener{
     *;
}

-keep class com.tencent.youtufacelive.YTPreviewHandlerThread$ISetCameraParameterListener{
     *;
}

# 保留自定义控件(继承自View)不能被混淆
-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(***);
    *** get* ();
}

#######################云刷脸混淆规则 faceverify-END#############################

云公共组件的混淆规则

您可以将如下代码拷贝到您的混淆文件中,也可以将 SDK 中的webank-cloud-normal-proguard-rules.pro拷贝到主工程根目录下,然后通过-include webank-cloud-normal-rules.pro加入到您的混淆文件中。

#######################webank normal混淆规则-BEGIN#############################
#不混淆内部类
-keepattributes InnerClasses
-keepattributes *Annotation*
-keepattributes Signature
-keepattributes Exceptions
-keep, allowobfuscation @interface com.webank.normal.xview.Inflater
-keep, allowobfuscation @interface com.webank.normal.xview.Find
-keep, allowobfuscation @interface com.webank.normal.xview.BindClick

-keep @com.webank.normal.xview.Inflater class *
-keepclassmembers class * {
    @com.webank.normal.xview.Find *;
    @com.webank.normal.xview.BindClick *;
}

-keep public class com.webank.normal.net.*$*{
    *;
}
-keep public class com.webank.normal.net.*{
    *;
}
-keep public class com.webank.normal.thread.*{
   *;
}
-keep public class com.webank.normal.tools.*{
   *;
}
-keep public class com.webank.normal.thread.*$*{
   *;
}
-keep public class com.webank.normal.tools.secure.*{
   *;
}
-keep public class com.webank.normal.tools.WLogger{
    *;
}

#webank normal包含的第三方库bugly
-keep class com.tencent.bugly.webank.**{
    *;
}

#wehttp混淆规则
-dontwarn com.webank.mbank.okio.**
-keep class com.webank.mbank.okio.**{
    *;
}

-keep class com.webank.mbank.wejson.*{
    *;
}

-dontwarn com.webank.mbank.okhttp3.OkHttpClient$Builder

-keep class com.webank.mbank.okhttp3.**{
    public <methods>;
}
-keep class com.webank.mbank.wehttp.**{
    public <methods>;
}
-keep interface com.webank.mbank.wehttp.**{
    public <methods>;
}
-keep public class com.webank.mbank.wehttp.WeLog$Level{
    *;
}
-keep public class com.webank.mbank.wehttp.WeReq$ErrType{
    *;
}
-keep class * extends com.webank.mbank.wehttp.WeReq$WeCallback{
   public <methods>;
}
-keep class com.webank.mbank.wehttp2.**{
    public <methods>;
}
-keep interface com.webank.mbank.wehttp2.**{
    public <methods>;
}
-keep public class com.webank.mbank.wehttp2.WeLog$Level{
    *;
}
-keep public class com.webank.mbank.wehttp2.WeReq$ErrType{
    *;
}
-keep class * extends com.webank.mbank.wehttp.WeReq$Callback{
   public <methods>;
}

#######################webank normal混淆规则-END#############################

云刷脸依赖的第三方库的混淆规则

您可以根据您现有的混淆规则,将缺少的第三库混淆规则拷贝到您的混淆文件中。

########云产品依赖的第三方库 混淆规则-BEGIN############

## support:appcompat-v7
-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }

-keep public class * extends android.support.v4.view.ActionProvider {
    public <init>(android.content.Context);
}

#########云产品依赖的第三方库 混淆规则-END#############
目录