Android Studio 3.0 Gradle 配置变更
作者:瘟疫幽魂
这篇文章主要介绍了Android Studio 3.0 Gradle 配置变更的相关知识,即多渠道打包变更和更改打包命名及路径的代码,感兴趣的朋友跟随脚本之家小编一起看看吧
多渠道打包变更
flavorDimensions "default"
productFlavors {
xxxx { dimension "default" }
}
productFlavors.all {
flavor -> flavor.manifestPlaceholders = [CHANNEL_VALUE: name]
}
更改打包命名及路径
android.applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "${variant.flavorName}.apk"
outputFileName = new File("../../../apk", fileName)
}
}
}
}
总结
以上所述是小编给大家介绍的Android Studio 3.0 Gradle 配置变更,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
