plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-android-extensions'
}

android {


    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
    defaultConfig {
        applicationId rootProject.ext.android["applicationId"]
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]

        consumerProguardFiles 'consumer-rules.pro'

        flavorDimensions "versionCode"


        ndk {
            abiFilters "armeabi-v7a","armeabi"
           // abiFilters "arm64-v8a"
        }
    }


    signingConfigs {
        debug {
            storeFile file('./src/main/jks/hh-face.jks')
            storePassword 'Nqj##117521'
            keyAlias 'hemile'
            keyPassword 'Nqj##117521'
        }
        release {
            storeFile file('./src/main/jks/hh-face.jks')
            storePassword 'Nqj##117521'
            keyAlias 'hemile'
            keyPassword 'Nqj##117521'
        }
    }

    buildTypes {
        // 因为支付宝刷脸需要包名一致，所以以后仅使用release版本，不再使用debug版本
        release {
            // 服务器地址
            // 正式
            buildConfigField("String", "BASE_URL", "\"https://tx.hz-hanghui.com:8088/\"")
            buildConfigField("String", "BASE_API_URL", "\"hanghui-server-platform/\"")
            buildConfigField("String", "BASE_URL_OMC", "\"https://hhomc.hz-hanghui.com:8096/\"")
            // aidl服务端包名
            buildConfigField("String", "AIDL_SERVER_APP_PACKAGE_NAME", "\"com.hh.hhomc\"")
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            shrinkResources false
            minifyEnabled false
            zipAlignEnabled true

            debuggable true
            jniDebuggable true
            testCoverageEnabled false

            // 3.0后的配置
            applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    def outputFile = output.outputFile
                    if (outputFile != null && outputFile.name.endsWith('.apk')) {
                        // 输出apk名称为jjb_v1.0_wandoujia.apk
                        def fileName_new = "hharome_v${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"
                        outputFileName = fileName_new
                    }
                }
            }
        }


    }


    // 与buildTypes中输出签名后的apk对应
    productFlavors {
        app {}
    }

    productFlavors.all {
        flavor -> flavor.manifestPlaceholders = [CHANNEL_VALUE: name]
    }


    dexOptions {
        javaMaxHeapSize "4g"
    }

    repositories {
        flatDir {
            dirs 'libs'
        }
    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    ndkVersion '21.0.6113669'

    // 去除重复的so
    packagingOptions {
        // pickFirsts:当出现重复文件，会使用第一个匹配的文件打包进入apk
        pickFirst 'lib/armeabi-v7a/libandroid_serial_port.so'
        pickFirst 'lib/armeabi-v7a/libserial_port.so'
        pickFirst 'lib/armeabi/libserial_port.so'

        //天波身份证和打印机用的是同一个架包
        pickFirst 'lib/armeabi-v7a/libidcard.so'
        pickFirst 'lib/armeabi-v7a/libsystem_util.so'
        pickFirst 'lib/armeabi-v7a/libtb_wlt2bmp.so'
        pickFirst 'lib/armeabi-v7a/libtelpo_serial.so'

        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'

        exclude 'okhttp3/internal/publicsuffix/publicsuffixes.gz'
    }
    configurations.all {
        resolutionStrategy {
            force 'androidx.appcompat:appcompat:1.1.0'
        }
    }
}

dependencies {

    implementation  rootProject.ext.dependencies["appcompat"]
    implementation  rootProject.ext.dependencies["material"]
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    // 添加base依赖
    implementation project(path: ':lib_base')
    implementation project(path: ':lib_common')

    implementation  rootProject.ext.dependencies["rxjava2"]
    implementation  rootProject.ext.dependencies["rxandroid2"]
    implementation  rootProject.ext.dependencies["okhttp3"]
    implementation  rootProject.ext.dependencies["okhttp3-log"]
    implementation  rootProject.ext.dependencies["retrofit"]
    implementation  rootProject.ext.dependencies["retrofit-gson"]
    implementation  rootProject.ext.dependencies["gson"]
    implementation  rootProject.ext.dependencies["eventbus"]
    implementation  rootProject.ext.dependencies["glide"]
    //国密ma4加解密及签名
    implementation 'com.blankj:utilcodex:1.31.1'
    //TTS
    implementation project(path: ':lib_tts')
    //各设备厂商提供的控制代码
    implementation project(path: ':lib_device')
    //AMPE
    implementation project(path: ':lib_ampe')
    //刷脸、FACE
    implementation project(path: ':lib_face')
    //身份证
    implementation project(path: ':lib_idcard')
    implementation project(path: ':lib_idcard:lib_idcard_base')
    implementation project(path: ':lib_idcard:lib_nfc_readcard')
    //副屏库
    implementation project(':secondaryscreen')
    //红外线
    implementation project(':lib_infrared')
    //二维码
    implementation project(':lib_qr')
    //实时语音
    implementation project(':lib_record')
    //社保卡
    implementation project(':lib_social_security_card')
    //NFC
    implementation project(':lib_nfc')
    //打印机
    implementation project(':lib_print')
    //东信多合一基础包
    implementation project(':lib_dx_base_multi')
    //数科 ASR 语音识别
    implementation project(':lib_asr')

}
repositories {
    mavenCentral()
}