def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'
android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    signingConfigs {

        release {
            keyAlias 'cyhd'
            keyPassword '@)!&8888cyhd'
            storeFile file('../cyhdSign')
            storePassword '@)!&8888cyhd'
        }
    }


    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.cyhd.henhoandroid"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        // manifestPlaceholders = [
        //         AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key
        // ]
            ndk {
                 abiFilters 'armeabi-v7a'
            }
        multiDexEnabled true
        manifestPlaceholders = [
                JPUSH_PKGNAME : 'com.cyhd.henhoandroid',
                JPUSH_APPKEY : "13dd603952a6632d1dd3ac54", // NOTE: JPush 上注册的包名对应的 Appkey.
                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.

                AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key

                XIAOMI_APPKEY:"MI-5221829498125",//小米平台注册的appkey
                XIAOMI_APPID:"MI-2882303761518294125",//小米平台注册的appid
//
                HUAWEI_APPID:"101961905",//华为平台注册的appid


                OPPO_APPKEY : "OP-cd9ece5049514019842f54d537068018", // OPPO平台注册的appkey
                OPPO_APPID : "OP-30233397", // OPPO平台注册的appid
                OPPO_APPSECRET: "OP-您的应用对应OPPO的APPSECRET",//OPPO平台注册的appsecret

//
//                MEIZU_APPKEY:"MZ-您的应用对应的魅族appkey",//魅族平台注册的appkey
//                MEIZU_APPID:"MZ-您的应用对应魅族的appid",//魅族平台注册的appid

        ]
    }

    buildTypes {
        release {
//                minifyEnabled true //混淆
//                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//                shrinkResources false
            signingConfig signingConfigs.release
            minifyEnabled false
            shrinkResources false
        }
        debug {
            signingConfig signingConfigs.release
            minifyEnabled false
            shrinkResources false
        }
    }


}

flutter {
    source '../..'
}

subprojects {
    if (project.hasProperty("android")) {
        android {
            compileSdkVersion 28
        }
    }
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "27.1.1"
                }

                if (details.requested.group == 'androidx.core'
                        && !details.requested.name.contains('androidx') ) {
                    
                }
        }
    }
}


dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    //implementation 'com.amap.api:location:latest.integration'
    implementation 'com.android.support:multidex:1.0.3'


    //接入厂商推送-跟jpush插件版本要配套
    implementation 'cn.jiguang.sdk.plugin:xiaomi:3.3.4'
//    implementation 'cn.jiguang.sdk.plugin:huawei:3.3.4'


    implementation 'com.huawei.hms:push:3.0.3.301'
    implementation files('src/main/libs/jpush-android-plugin-huawei-v3.5.4.jar')

//    implementation'cn.jiguang.sdk.plugin:meizu:3.4.1'//JPushSDK3.4.1
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    implementation files('src/main/libs/jpush-android-plugin-fcm-v3.5.4.jar')

    implementation 'cn.jiguang.sdk.plugin:oppo:3.3.4'
    compile "androidx.core:core-ktx:+"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

}
repositories {
    mavenCentral()
}
