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

apply plugin: "embrace-swazzler"

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') ?: '1')
def flutterVersionName = (localProperties.getProperty('flutter.versionName') ?: '1.0')

android {
    namespace "io.embrace.flutter.example"

    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions { jvmTarget = '1.8' }

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

    defaultConfig {
        applicationId "io.embrace.flutter.example"
        minSdkVersion 26
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "androidx.multidex:multidex:2.0.1"
}
