Skip to content

Instantly share code, notes, and snippets.

@meeDamian
Last active August 29, 2015 14:11
Show Gist options
  • Save meeDamian/5515c2d5e66e7fdee462 to your computer and use it in GitHub Desktop.
Save meeDamian/5515c2d5e66e7fdee462 to your computer and use it in GitHub Desktop.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId 'pl.d30.binClock'
minSdkVersion 15
targetSdkVersion 21
versionCode 21
versionName "0.6.1"
useJack = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
release {
storeFile file(project.STORE_FILE)
storePassword project.STORE_PASSWORD as String
keyAlias project.KEY_ALIAS as String
keyPassword project.KEY_PASSWORD as String
}
}
buildTypes {
release {
minifyEnabled true
zipAlignEnabled true
// shrinkResources true
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
if (output.name == "release") {
def file = output.outputFile
String parent = file.parent
if (project.hasProperty('OUTPUT_DIR') && new File(project.OUTPUT_DIR as String).exists())
parent = project.OUTPUT_DIR
output.outputFile = new File(
parent,
file.name.replace(
".apk",
"-" + (defaultConfig.versionName as String) + "-build" + (defaultConfig.versionCode as String) + ".apk"
) as String
)
}
}
}
}
}
}
dependencies {
compile 'com.android.support:support-annotations:20.0.0'
}
@minakov
Copy link

minakov commented Dec 23, 2014

apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId 'pl.d30.binClock'
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 21
        versionName "0.6.1"

        useJack = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    signingConfigs {
        release {
            storeFile file(project.STORE_FILE)
            storePassword project.STORE_PASSWORD as String
            keyAlias project.KEY_ALIAS as String
            keyPassword project.KEY_PASSWORD as String
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            zipAlignEnabled true
            // shrinkResources true
            signingConfig signingConfigs.releaseConfig
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            if (output.name == "release") {
                def file = output.outputFile
                String parent = file.parent

                if (project.hasProperty('OUTPUT_DIR') && new File(project.OUTPUT_DIR as String).exists())
                    parent = project.OUTPUT_DIR

                output.outputFile = new File(
                    parent,
                    file.name.replace(
                        ".apk",
                        "-" + (defaultConfig.versionName as String) + "-build" + (defaultConfig.versionCode as String) + ".apk"
                    ) as String
                )
            }
        }
    }
}
dependencies {
    compile 'com.android.support:support-annotations:20.0.0'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment