When I use Android Studio 3.0 and I use the next version of Android Gradle Plugin in project/build.gradle:
cl
I think using "./../../../" is bad solution... I use common gradle script for several projects and I want to make code to be independency from depth of output dir.
After some researching I found this solution for gradle plugin 3.1.2:
applicationVariants.all { variant ->
variant.outputs.all { output ->
def relativeRootDir = output.packageApplication.outputDirectory.toPath()
.relativize(rootDir.toPath()).toFile()
output.outputFileName = new File( "$relativeRootDir/release", newOutputName)
}
}