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"]

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'

        flavorDimensions "versionCode"


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

    }


    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_URL", "\"https://test.hz-hanghui.com:18890/\"")

            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\"")

            resValue "string", "app_name", "HHArome"

            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
                    }
                }
            }
        }

        yufabu {
            applicationIdSuffix ".yufabu"

            buildConfigField("String", "BASE_URL", "\"http://192.168.11.87:8081/\"")
            buildConfigField("String", "BASE_API_URL", "\"hanghui/outapi/\"")

            buildConfigField("String", "BASE_URL_OMC", "\"http://192.168.11.9:9086/\"")

            // aidl服务端包名
            buildConfigField("String", "AIDL_SERVER_APP_PACKAGE_NAME", "\"com.hh.hhomc.yufabu\"")

            // 测试的IM信息
//            buildConfigField("int", "TIM_SDKAPPID", "1400803088")
//            buildConfigField("String", "TIM_SECRETKEY", "\"f942e1545dd5465c6d54fe68d2c42d9af424a2e7f3ed84133bc2f7b40191b271\"")

            resValue "string", "app_name", "测试HHArome"

            minifyEnabled false
            shrinkResources false

            jniDebuggable true
            debuggable true
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            applicationIdSuffix ".test"

//            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/\"")

            buildConfigField("String", "BASE_URL", "\"https://test.hz-hanghui.com:18890/\"")
            buildConfigField("String", "BASE_API_URL", "\"hanghui-server-platform/\"")
//            buildConfigField("String", "BASE_URL", "\"http://192.168.11.17:8081/\"")
//            buildConfigField("String", "BASE_API_URL", "\"hanghui/outapi/\"")

            buildConfigField("String", "BASE_URL_OMC", "\"http://192.168.11.9:9086/\"")

            // aidl服务端包名
            buildConfigField("String", "AIDL_SERVER_APP_PACKAGE_NAME", "\"com.hh.hhomc.test\"")

            resValue "string", "app_name", "开发HHArome"

            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            shrinkResources false
            minifyEnabled false
            zipAlignEnabled true

            debuggable true
            jniDebuggable true
            testCoverageEnabled false
        }

    }


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

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


    dexOptions {
        javaMaxHeapSize "4g"
    }

    repositories {
        flatDir {
            dirs 'libs'
//            , '../lib_print/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 'org.greenrobot.eventbus'
    }

}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//    implementation files('libs\\telpo_sdk_210726.jar')
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'


//    implementation files('libs/SerialPort.jar')

    // 添加base依赖
    implementation project(path: ':lib_base')
//    implementation project(path: ':lib_print')
    // 打印
//    implementation(name: 'printlib-debug', ext: 'aar')
    implementation project(path: ':lib_print')

    // USB二维码
    implementation project(path: ':lib_usb_qr')


    // 身份证
//    implementation project(path: ':lib_idcard')
    // 微信xlog日志
    implementation 'com.elvishew:xlog:1.10.1'

    // 百度语音
    implementation files('libs/com.baidu.tts_2.3.0.jar')

    // 支付宝刷脸
    implementation(name: 'ABCP-API-5.5.2.4-lite', ext: 'aar')
    // 金联汇通-在线身份证-nfc
    implementation files('libs/IDOCR.PubSdk.Android.Std.NFC.Release-11.0.4.jar')
    // 金联汇通-在线身份证-usb
    implementation files('libs/IDOCR.PubSdk.Android.SerialPort.Release-1.0.4.jar')
    // 关机
//    implementation files('libs/PosUtil.jar')
    // 马里奥y9——硬件所需
    implementation files('libs/OrbbecSSDK_1.0.0.3_0f2b082_240327.jar')
    // 天波-D2补光灯
    implementation files('libs/posutil_sdk_20231226.jar')

    // 天波-D2
//    implementation files('libs/telpo_sdk_210726.jar'){
////        exclude module: 'com.github.maybesix:Android-XHLibrary'
//    }

    // AMPE
    implementation(name: 'aromecli-build-1.0.0.230918203554', ext: 'aar')

    // 新中新
    implementation project(':idCard')
    implementation project(path: ':MultiReaderLib')

    implementation 'com.alibaba:fastjson:1.2.76'

    //串口
    implementation 'com.github.licheedev:Android-SerialPort-API:2.0.0'
    //二维码串口
    implementation 'com.aill:AndroidSerialPort:1.0.8'
    // 串口通信
    implementation 'com.github.felHR85:UsbSerial:4.5.2'
    implementation project(':SeriaApp')

    //串口
//    implementation 'com.github.maybesix:Android-XHLibrary:v1.0.0'

    implementation 'com.jakewharton:butterknife:7.0.0'
    //国密ma4加解密及签名
    implementation 'com.blankj:utilcodex:1.31.1'
    implementation 'cn.hutool:hutool-all:5.4.5'
    implementation 'org.bouncycastle:bcprov-jdk15to18:1.69'


    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
//    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.32"

    // pcm转mp3
//    implementation 'com.github.oshiro-pp:lamejni:1.0.1'
//    implementation 'com.github.mik3y:lame4android:1.0.10'

    // 录音
//    implementation 'com.github.zhaolewei:ZlwAudioRecorder:v1.07'
    implementation project(':recorderlib')
//    implementation 'com.mpatric:mp3agic:0.9.1'

    // bugly
    implementation 'com.tencent.bugly:crashreport:4.0.4'

    //GT基础功能(必要的)
//    implementation 'com.github.1079374315:GSLS_Tool:v1.4.5.2'

}
repositories {
    mavenCentral()
}