apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.huawei.agconnect'
apply plugin: 'kotlin-parcelize'


def rely = rootProject.ext.relyOn
def androidId = rootProject.ext.defaultSetting
def url = rootProject.ext.url
def imagePrefix =rootProject.ext.image_preifx


android {
    compileSdkVersion androidId.compileSdk
    buildToolsVersion androidId.buildToolsVersion

    defaultConfig {
        applicationId androidId.appId
        minSdkVersion androidId.minSdk
        targetSdkVersion androidId.targetSdk
        versionCode androidId.versionCode
        versionName androidId.versionName

        kapt {
            arguments {
                arg("AROUTER_MODULE_NAME", project.getName())
            }
        }

        manifestPlaceholders = [
                JPUSH_PKGNAME : applicationId,
                JPUSH_APPKEY : "4469bc1d5cfba9e5aea1cac4",
                //暂时填写默认值即可.
                JPUSH_CHANNEL : "developer-default",

                OPPO_APPKEY : "OP-", // OPPO平台注册的appkey
                OPPO_APPID : "OP-", // OPPO平台注册的appid
                OPPO_APPSECRET: "OP-",//OPPO平台注册的appsecret

                XIAOMI_APPKEY : "MI-5992028541716",// 小米平台注册的appkey
                XIAOMI_APPID : "MI-2882303761520285716", // 小米平台注册的appid

                VIVO_APPKEY:"",
                VIVO_APPID:"",
                HONOR_APPID:"109849297"
        ]
        // 配置 APK 输出路径
        applicationVariants.all { variant ->
            if (variant.buildType.name == "release") {
                def date = new Date().format("yyyyMMddHHmmss")
                variant.outputs.all {
                    outputFileName = "ZJ365-${variant.name}-${versionName}-${date}.apk"
                }
            }
        }
        buildConfigField("String" ,"appid" ,"\"${rootProject.ext.wx.appid}\"")
        buildConfigField("String" ,"appSecret" ,"\"${rootProject.ext.wx.appSecret}\"")

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs{
        release {
            storeFile file('../zj365.keyStore')
            keyAlias 'zj365'
            keyPassword 'zj36566'
            storePassword 'zj36566'
        }
    }

    buildTypes {
        release {
            buildConfigField("String", "url", "\"${url.release_url}\"")
            buildConfigField("String","h5url","\"${url.h5_release_url}\"")
            buildConfigField("String", "image_prefix","\"${imagePrefix.release_url}\"")
            buildConfigField("Boolean","isRelease",String.valueOf(true))
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug {
            buildConfigField("String", "url", "\"${url.debug_url}\"")
            buildConfigField("String","h5url","\"${url.h5_debug_url}\"")
            buildConfigField("Boolean","isRelease",String.valueOf(false))
            buildConfigField("String", "image_prefix","\"${imagePrefix.debug_url}\"")
            signingConfig signingConfigs.release
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    viewBinding {
        enabled = true
    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }

}

repositories {
    flatDir {
        dirs 'libs'
    }

    project.afterEvaluate {
        com.android.build.gradle.BaseExtension android = project.extensions.getByName("android")
        android.getPackagingOptions().exclude("META-INF/*.kotlin_module")
    }
}




dependencies {

    implementation (name: 'ycbtsdk-release', ext: 'aar')
    implementation (name: 'push-3.0.0', ext: 'aar')
    implementation files('libs/bluetooth-mini-fatscale-2.9.5.jar')
    implementation files('libs/bluetooth-mini-core-2.9.5.jar')
    implementation project(':Health')
    implementation project(':server')
    implementation project(':mine')
 //   implementation project(':AYCrashGuard')
    kapt rely.arouter_compiler
    kapt rely.GifDrawable
    kapt rely.xutil

}