如何通过Jenkins中的构建数量来设置Android应用程序版本? [英] How to set android app version by number of build in Jenkins?
本文介绍了如何通过Jenkins中的构建数量来设置Android应用程序版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的build.gradle文件
//顶层构建文件,您可以在其中添加对所有子项目/模块通用的配置选项。
buildscript {
repositories {
mavenCentral()
}
依赖关系{
classpath'com.android.tools.build:gradle: 0.12.2'
}
}
allprojects {
储存库{
mavenCentral()
}
}
build.sh
#!/ bin / bash
gradle clean
gradle build
#。 run_android_ui_tests.sh
我的gradle.properities只包含注释。
<$ c解决方案
c> def env = System.getenv()
versionName1. + env ['BUILD_NUMBER']
而不是
versionName1.0
Application is automatically building by jenkins after successful push, but version is always 1.0. Instead of "0" I want to insert number of corresponding build in jenkins: 1.119, 1.120, 1.121...
That is my build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
allprojects {
repositories {
mavenCentral()
}
}
build.sh
#!/bin/bash
gradle clean
gradle build
#. run_android_ui_tests.sh
My gradle.properities contains only comments.
解决方案
Problem solved by inserting these two strings into build.gradle's defaultConfig:
def env = System.getenv()
versionName "1." + env['BUILD_NUMBER']
instead of
versionName "1.0"
这篇关于如何通过Jenkins中的构建数量来设置Android应用程序版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文