修改如下面就可以了
applicationVariants.all { variant ->
variant.outputs.each { output ->
variant.packageApplicationProvider.get().outputDirectory = new File(project.rootDir.absolutePath + "/apk")
def fileName
if (output.name == 'debug') {
fileName = "AppName-v${defaultConfig.versionName}-c${defaultConfig.versionCode}-test.apk"
} else {
fileName = "AppName-v${defaultConfig.versionName}-c${defaultConfig.versionCode}.apk"
}
output.outputFileName = fileName
}
}
网友评论