Newer
Older
DummyAnd / app / build.gradle
// Load a specific properties file to access the keystore if exists
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("keystore.properties")

if (keystorePropertiesFile.exists() ) {
    // Load keystore properties from file
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} else {
    // Load keystore properties from environment
    def env = System.getenv()
    if (env['ANDROID_KEYALIAS']) keystoreProperties.put('keyAlias', env['ANDROID_KEYALIAS'])
    else keystoreProperties.put('keyAlias', "dappre")
    if (env['ANDROID_KEYPASSWORD']) keystoreProperties.put('keyPassword', env['ANDROID_KEYPASSWORD'])
    else keystoreProperties.put('keyPassword', "dappre")
    if (env['ANDROID_STOREFILE']) keystoreProperties.put('storeFile', env['ANDROID_STOREFILE'])
    else keystoreProperties.put('storeFile', "./certificate/dappre.jks")
    if (env['ANDROID_STOREPASSWORD']) keystoreProperties.put('storePassword', env['ANDROID_STOREPASSWORD'])
    else keystoreProperties.put('storePassword', "dappre")
}

apply plugin: 'com.android.application'

android {
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    defaultConfig {
        applicationId "nl.digital_me.dummyandroidapp"
        minSdkVersion 14
        targetSdkVersion rootProject.ext.compileSdkVersion
        versionCode project.hasProperty('versionCode') ? project.property('versionCode') as int : 50
        versionName project.hasProperty('versionName') ? project.property('versionName') : "0.0.5"
        multiDexEnabled true
    }
    dexOptions {
        maxProcessCount 1
        threadCount 4
        javaMaxHeapSize "2048m"
        preDexLibraries false
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable false
        }
    }
    productFlavors {
    }
    applicationVariants.all {
        variant ->
            if (variant.buildType.name == "release") {
                variant.outputs.each {
                    output ->
                        if (variant.getBuildType().isMinifyEnabled()) {
                            variant.assemble.doLast {
                                copy {
                                    from variant.mappingFile
                                    into output.outputFile.parent
                                }
                            }
                        }
                }
           }
    }
}

dependencies {
    //compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
    implementation 'com.android.support:multidex:1.0.3'
}