出处
下面是做的一些笔记
多渠道打包
"360"{
manifestPlaceholders = [channel:"360"]
}
如果渠道名是数字开头,则必须加引号
build-type中的参数
// minifyEnabled 混淆处理
// shrinkResources 去除无用资源
// signingConfig 签名
// proguardFiles 混淆配置
// applicationIdSuffix 增加APP ID的后缀
// debuggable 是否保留调试信息
自定义输出apk名称
android {
// rename the apk with the version name
// add output file sub folder by build type
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent + "/${variant.buildType.name}",
"ganchai-${variant.buildType.name}-${variant.versionName}-${variant.productFlavors[0].name}.apk".toLowerCase())
}
}
}
额外信息
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
(类型,名称,方法名)
resValue "string","build_time",buildTime()
resValue "string","build_host",buildHost()
}
}
def buildTime(){
//获取当前时间
return new Date().format("yyyy-MM-dd HH:mm:ss")
}
def buildHost(){
//获取当前计算机名称
return System.getProperty("user.name") + "@" + InetAddress.localHost.hostName
}
3万+

被折叠的 条评论
为什么被折叠?



