Android Studio生成APK自动追加版本号
2015-04-02
1 Comments 12,040 Views 0 Times
说明
个人备用,大家可以参考,可自动区分debug和release
- 打开 build.gradle
- 在 android 节点中插入下面代码
代码
|
android.applicationVariants.all
{
variant
->
variant.outputs.each
{
output
->
output.outputFile
=
new
File(output.outputFile.parent,
defaultConfig.applicationId
+
"-"
+
buildType.name
+
"-v"
+
defaultConfig.versionName
+
"-"
+
defaultConfig.versionCode
+
".apk"
);
}
}
|
事例
com.sollyu.fuckflymetheme-release-v1.0-1.apk