-
-
Save JLamkin/8011068 to your computer and use it in GitHub Desktop.
Changed each to all, since each is out of date. And added more generic replacement.
This file contains 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 { | |
defaultConfig { | |
versionName "actionbar" | |
} | |
signingConfigs { | |
release { | |
storeFile file("android.keystore") | |
... | |
} | |
} | |
sourceSets { | |
main { | |
manifest.srcFile 'AndroidManifest.xml' | |
res.srcDirs = ['res'] | |
assets.srcDirs = ['assets'] | |
} | |
} | |
buildTypes { | |
debug { | |
versionNameSuffix "dev" | |
} | |
release { | |
signingConfig signingConfigs.release | |
} | |
} | |
buildToolsVersion "17.0" | |
compileSdkVersion 17 | |
} | |
project.archivesBaseName = "Acme-Project-REPLACEME"; | |
android.applicationVariants.all { variant -> | |
def apk = variant.outputFile | |
def newManifest = variant.processManifest.manifestOutputFile | |
def versionCode = getVersionCode(newManifest.path) | |
if (versionCode == -1) { | |
return | |
} | |
def newName | |
if (variant.buildType.name == "release") { | |
newName = apk.name.replace("REPLACEME", versionCode); | |
} else { | |
newName = apk.name.replace("REPLACEME", ""); | |
} | |
//noinspection GroovyAssignabilityCheck | |
variant.outputFile = new File(apk.parentFile, newName) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment