plugins {
    id 'com.android.application'
}

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


    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 {

            // 服务器地址
            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\"")

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

            minifyEnabled false
            shrinkResources false

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

    }


    // 与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'

}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    // 添加base依赖
    implementation project(path: ':lib_base')

    // 微信xlog日志
    implementation 'com.elvishew:xlog:1.10.1'


    // 支付宝刷脸
    implementation(name: 'ABCP-API-5.5.2.4-lite', ext: 'aar')
    // 在线身份证
    implementation files('libs/IDOCR.PubSdk.Android.Std.NFC.Release-11.0.4.jar')
    //
    implementation files('libs/PosUtil.jar')

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


    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'

}