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

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


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

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    namespace "com.didvan.didvanapp"
    compileSdk 35
    ndkVersion "25.1.8937393"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

        coreLibraryDesugaringEnabled true
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.didvan.didvanapp"
        minSdkVersion 24
        //noinspection ExpiredTargetSdkVersion
        targetSdkVersion 34
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            storeFile file("keystore.jks") 
            storePassword "12799721"
            keyAlias "upload"
            keyPassword "12799721"
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
    }
    buildFeatures {
        viewBinding true
    }

    splits {
        //configure apks based on ABI
        abi {
            enable true
            reset()
            include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
            universalApk true

        }
//        density {
//            enable true
//            reset()
//            include "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"
//        }
    }
}

flutter {
    source '../..'
}

dependencies {
    // implementation platform('com.google.firebase:firebase-bom:29.1.0')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10"
    implementation 'com.google.code.gson:gson:2.10.1'
    implementation 'com.squareup.picasso:picasso:2.8'
    implementation "androidx.room:room-runtime:2.2.5"
    implementation "androidx.sqlite:sqlite-framework:2.1.0"
    implementation "androidx.sqlite:sqlite:2.1.0"
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
    implementation 'androidx.appcompat:appcompat:1.6.1'
}
