I want to have the versionName
included in the name of the output APK files from my Android build.
There's an another answer that works with pre-0.14.x plugin versions, but they changed some of the data model so that doesn't work anymore, and I couldn't figure out how to fix it. As far as I can tell, the below chunk of code should work, but that last set()
call appears to have no effect. It doesn't throw an error, but the value isn't replaced either.
buildTypes {
applicationVariants.all { variant ->
def oldFile = variant.outputs.outputFile.get(0)
def newFile = new File(
oldFile.parent,
oldFile.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
variant.outputs.outputFile.set(0, newFile)
}
Can someone help me out with this?