build.gradle 2.56 KB
Newer Older
Nikhil Jha's avatar
Nikhil Jha committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
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 GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

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

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

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

android {
    compileSdkVersion 27

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
Nikhil Jha's avatar
Nikhil Jha committed
36
        applicationId "com.nikhiljha.lobstersapp"
Nikhil Jha's avatar
Nikhil Jha committed
37 38
        minSdkVersion 16
        targetSdkVersion 27
Nikhil Jha's avatar
Nikhil Jha committed
39 40
        versionCode 2
        versionName "v0.0.2"
Nikhil Jha's avatar
Nikhil Jha committed
41 42
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
Nikhil Jha's avatar
Nikhil Jha committed
43 44 45
    
    signingConfigs {
        release {
Nikhil Jha's avatar
Nikhil Jha committed
46 47 48 49 50 51 52
            def keystorePropertiesFile = rootProject.file("key.properties")
            def keystoreProperties = new Properties()

            if (!keystorePropertiesFile.exists()) return;

            keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

Nikhil Jha's avatar
Nikhil Jha committed
53 54 55 56 57 58
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
Nikhil Jha's avatar
Nikhil Jha committed
59

Nikhil Jha's avatar
Nikhil Jha committed
60 61 62 63 64 65 66 67 68
    flavorDimensions "deploy"

    productFlavors {
        fdroid {
            dimension "deploy"
            signingConfig null
        }
    }

Nikhil Jha's avatar
Nikhil Jha committed
69 70 71 72 73 74 75 76
    android.applicationVariants.all { variant ->
        if (variant.flavorName == "fdroid") {
            variant.outputs.all { output ->
                output.outputFileName = "app-fdroid-release.apk"
            }
        }
    }

Nikhil Jha's avatar
Nikhil Jha committed
77 78
    buildTypes {
        release {
Nikhil Jha's avatar
Nikhil Jha committed
79
            signingConfig signingConfigs.release
Nikhil Jha's avatar
Nikhil Jha committed
80 81 82 83 84 85 86 87 88 89 90 91 92
        }
    }
}

flutter {
    source '../..'
}

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