Created
June 9, 2014 13:14
-
-
Save showsky/bf5cf570ced9af9a98ae to your computer and use it in GitHub Desktop.
Gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| android { | |
| compileSdkVersion rootProject.ext.compileSdkVersion | |
| buildToolsVersion rootProject.ext.buildToolsVersion | |
| defaultConfig { | |
| minSdkVersion 14 | |
| targetSdkVersion 19 | |
| } | |
| lintOptions { | |
| abortOnError false | |
| } | |
| signingConfigs { | |
| debug { | |
| storeFile file("../debug.keystore") | |
| storePassword "android" | |
| keyAlias "androiddebugkey" | |
| keyPassword "android" | |
| } | |
| release { | |
| storeFile file("../xxx.keystore") | |
| storePassword "xxxx" | |
| keyAlias "xxxx" | |
| keyPassword "xxxx" | |
| } | |
| } | |
| productFlavors { | |
| dev { | |
| applicationId 'com.miiitv.app' | |
| buildConfigField "String", "ENVIRONMENT", "\"dev\"" | |
| } | |
| beta { | |
| applicationId 'xxxx' | |
| buildConfigField "String", "ENVIRONMENT", "\"beta\"" | |
| } | |
| demo { | |
| applicationId 'xxxx' | |
| buildConfigField "String", "ENVIRONMENT", "\"demo\"" | |
| } | |
| production { | |
| applicationId 'xxxx' | |
| buildConfigField "String", "ENVIRONMENT", "\"production\"" | |
| } | |
| } | |
| buildTypes { | |
| debug { | |
| signingConfig signingConfigs.debug | |
| runProguard false | |
| } | |
| release { | |
| signingConfig signingConfigs.release | |
| runProguard true | |
| proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' | |
| } | |
| } | |
| } | |
| android.applicationVariants.all { variant -> | |
| appendVersionNameVersionCode(variant); | |
| } | |
| def appendVersionNameVersionCode(variant) { | |
| if (variant.zipAlign) { | |
| def file = variant.outputFile | |
| def fileName = file.name.replace(".apk", "-" + variant.processManifest.versionCode + ".apk") | |
| variant.outputFile = new File(file.parent, fileName) | |
| } | |
| def file = variant.packageApplication.outputFile | |
| def fileName = file.name.replace(".apk", "-" + variant.processManifest.versionCode + ".apk") | |
| variant.packageApplication.outputFile = new File(file.parent, fileName) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment