build.gradle 1.72 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 16 17 18 19 20 21 22 23
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

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

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

android {
28
    compileSdkVersion 28
29 30 31 32 33 34

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
35
        applicationId "io.flutter.examples.hello_world"
36
        minSdkVersion 16
37
        targetSdkVersion 28
38 39
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
40
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    }

    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 '../..'
}

dependencies {
57
    testImplementation 'junit:junit:4.12'
58 59
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
60
}