Skip to content

Instantly share code, notes, and snippets.

@frontrangerider2004
Created October 11, 2017 19:59
Show Gist options
  • Save frontrangerider2004/3c1df3fb94bba28c3bda6f69037980fd to your computer and use it in GitHub Desktop.
Save frontrangerider2004/3c1df3fb94bba28c3bda6f69037980fd to your computer and use it in GitHub Desktop.
semantic version names for output apk files
android {
...... other stuff here
....
// Rename output apk file to use semantic versioning (gradle 3.2+)
// This will create hyde-x.x.x-${productFlavor}-${buildType}-${isSigned}.apk
applicationVariants.all { variant ->
variant.outputs.each { output ->
def originalOutputFile = output.outputFile
output.outputFile = new File(originalOutputFile.parentFile,
originalOutputFile.name.replace("${archivesBaseName}", "${archivesBaseName}-${variant.versionName}"))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment