According to my CI requirements I'm trying to achieve two things:
- set apk file name in format: .apk
- set folder for generated .apk file: app/build/outputs/apk/myBuild.apk
I used android gradle plugin 2.3 and got following script to manage task above (it worked correctly for gradle plugin 2.3):
applicationVariants.all {
variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
variant.productFlavors.get(0).name + variant.buildType.name + ".apk")
}
Now I got the following code (according to latest updates in android gradle plugin 3.0):
applicationVariants.all { variant ->
variant.outputs.all { output ->
logger.debug("fileNameParent", output.outputFile.parent)
outputFileName = new File(
"apk/",
outputFileName.replace(".apk", "MyBuild.apk"))
}
And got following structure (see picture):
P.S. I read Android Gradle Plugin migration guide, but it doesn't help me to achieve my goal :(