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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// 导入MobSDK
apply plugin: 'com.mob.sdk'

MobSDK {
    appKey "30dc33054b635"
    appSecret "396e98c293130c9976fb7428b6b434d6"

    MobLink {
        uriScheme "fnoos://cn.zhios.zhiying"
        appLinkHost "bied.t4m.cn"
    }

    //手机验证登录
    SecVerify {}

    //短信
    SMSSDK {}

    ShareSDK {

        // platform configuration information
        devInfo {
            QQ {
                appId "1111030588"
                appKey "XoHKlrBybXy7ORBt"
                shareByAppClient true
                bypassApproval false
                enable true
            }
            Wechat {
                appId "wx598aaef252cd78e4"
                appSecret "d2fc2edf9ece746765b3bfc0bf1b230e"
                withShareTicket true
                bypassApproval false
                enable true
            }
            WechatMoments {
                bypassApproval false
                enable true
            }
            WechatFavorite {
                bypassApproval false
                enable true
            }
            QZone {
                enable true
            }
            SinaWeibo {
                enable true
            }
        }
    }
}

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "cn.zhios.zhiying"
//        applicationId "cn.sharesdk.demo"
        minSdkVersion 19
        targetSdkVersion 28
        aaptOptions.cruncherEnabled = false
        aaptOptions.useNewCruncher = false
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs{
        config {
            keyAlias 'demokey.keystore'
            keyPassword '123456'
            storeFile file('demokey.keystore')
            storePassword '123456'
        }
        release {
            storeFile file("zhiying.jks")
            storePassword "zhioscom"
            keyAlias "zysh"
            keyPassword "zhioscom"
            v1SigningEnabled true
            v2SigningEnabled true
        }
    }

    flavorDimensions "app"

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            signingConfig signingConfigs.release
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            signingConfig signingConfigs.release
        }
    }

    dexOptions {
        //最大堆内存
        javaMaxHeapSize "4g"//4g
        //使用增量模式构建
        incremental true
        //是否支持大工程模式
        jumboMode = true
        //预编译
        preDexLibraries = false
        //线程数
        threadCount = 8
    }

}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
