build.gradle.tmpl 1.93 KB
Newer Older
1 2 3
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
4 5
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
6 7 8 9 10 11 12 13
    }
}

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.")
}

14 15
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
16
    flutterVersionCode = '1'
17 18 19 20
}

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

24
apply plugin: 'com.android.application'
25
apply plugin: 'kotlin-android'
26 27 28
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
29
    compileSdkVersion flutter.compileSdkVersion
Daco Harkes's avatar
Daco Harkes committed
30
    ndkVersion flutter.ndkVersion
31

32 33 34 35 36
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

37
    defaultConfig {
38 39
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "{{androidIdentifier}}"
40 41
        // You can update the following values to match your application needs. 
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
42 43
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
44 45
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
46 47 48 49 50 51 52 53 54 55 56 57 58 59
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}