I have found similar questions but nothing that quite works for what I want to do. I\'m developing with Android Studio and gradle, and I have several flavors in my build file,
kcoppock's answer is correct, but there is a small typo. It should be:
android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parentFile,
output.outputFile.name.replace(".apk", "${variant.versionName}.apk"));
}
}
}
(I wrote this as an answer because I don't have the reputation to make a comment)