plugins {
    id "com.android.application"
    id "kotlin-android"
    id "kotlin-kapt"
    id "dev.flutter.flutter-gradle-plugin"
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

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 Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}


android {
    namespace 'com.guadou.yyemployer'
    compileSdk 35

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        // 如打包出现Failed to transform libs.jar to match attributes
        checkReleaseBuilds false
    }

    defaultConfig {
        applicationId "com.guadou.yyemployer"
        minSdkVersion 21
        targetSdkVersion 35
        versionCode 306
        versionName "3.0.6"

        multiDexEnabled true

        ndk {
            //选择要添加的对应 cpu 类型的 .so 库。
//            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
            abiFilters 'armeabi-v7a', 'arm64-v8a'
//            abiFilters 'armeabi-v7a'
//            abiFilters 'arm64-v8a'
        }

        manifestPlaceholders = [
                JPUSH_PKGNAME   : applicationId,
                JPUSH_APPKEY    : "1234567890",
                JPUSH_CHANNEL   : "developer-default",
                queryAllPackages: ""
        ]
    }

    //配置keystore签名
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
        debug {

        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            //默认系统混淆
            minifyEnabled true
            //是否可调试
            debuggable false
            //Zipalign优化
            zipAlignEnabled true
            //移除无用的resource文件
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            signingConfig signingConfigs.release
            //是否可调试
            debuggable true
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0"

    implementation 'com.github.bumptech.glide:glide:4.11.0'
    kapt 'com.github.bumptech.glide:compiler:4.11.0'

    implementation 'androidx.appcompat:appcompat:1.6.1'  //加入AndroidX依赖
    implementation 'com.android.support:multidex:1.0.3'
//    implementation 'androidx.core:core-splashscreen:1.0.0' //启动12兼容
}
