Android Android 自定义生成的 apk 文件名

xinggang · 2017年04月10日 · 53 次阅读

将以下代码放置于 build.gradle 文件的 android 节点中即可。

// rename the apk with the version name
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        output.outputFile = new File(
                output.outputFile.parent + "/${variant.buildType.name}",
                "lttc-${variant.versionName}.apk".toLowerCase())
    }
}

生成的文件名为:lttc-版本名称.apk

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册