Browse Source

[编译][更改]:添加版本号管理逻辑

tags/jenkins-front-end-screenad-12
hupeng 6 years ago
parent
commit
16628a00da
1 changed files with 21 additions and 2 deletions
  1. +21
    -2
      android/app/build.gradle

+ 21
- 2
android/app/build.gradle View File

@@ -98,13 +98,28 @@ android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

def getVersionCode = { ->
return project.hasProperty('versionCode') ? project.versionCode : 1
}

def getVersionName = { ->
return project.hasProperty('versionName') ? project.versionName : "1.0"
}

defaultConfig {
applicationId "com.screenad"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
versionCode = getVersionCode()
versionName getVersionName()
}

android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "screenad_" + variant.buildType.name + "_v" + defaultConfig.versionName + ".apk"
}
}

splits {
abi {
reset()
@@ -114,7 +129,11 @@ android {
}
}
buildTypes {
debug {
buildConfigField "String", "API_HOST", "\"https://mall.youlane.cn/\""//API Host
}
release {
buildConfigField "String", "API_HOST", "\"https://admin.malls.iformall.com/\""//API Host
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}


Loading…
Cancel
Save