diff --git a/android/app/build.gradle b/android/app/build.gradle index 890edbe..b59a139 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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" }