直接上代码:
android.libraryVariants.all { variant ->
println("variant===================")
println(variant)
println(variant.buildType)
println(variant.buildType.name)
if (variant.buildType.name.equals('release')) {//在release包的时候才修改
variant.outputs.each { output ->
println("output===================")
println(output)
println(output.outputFile)
new File(output.outputFile.parent).deleteDir()//删除当前目录下的现有文件
def outputFileName = "xxxxxx.aar"
output.outputFile = new File(output.outputFile.parent, outputFileName)
}
}
}
网友评论