Last active
April 30, 2023 06:47
-
-
Save WSAyan/1d5e0c04c217a6f7896af31a9dbb9521 to your computer and use it in GitHub Desktop.
Product flavor and rename apk example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
apply plugin: 'kotlin-kapt' | |
android { | |
compileSdkVersion 28 | |
defaultConfig { | |
applicationId "com.example.example" | |
minSdkVersion 19 | |
targetSdkVersion 28 | |
versionCode 1 | |
versionName "2.0.1" | |
dataBinding.enabled = true | |
multiDexEnabled true | |
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |
} | |
buildTypes { | |
debug { | |
minifyEnabled false | |
} | |
release { | |
minifyEnabled false | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
} | |
applicationVariants.all { variant -> | |
variant.outputs.all { | |
outputFileName = "example-v${variant.versionCode}-${variant.versionName}-${new Date().format('ddMMyy_HHmm')}-${variant.flavorName}-${variant.buildType.name}.apk" | |
} | |
} | |
} | |
flavorDimensions "version" | |
productFlavors { | |
demo { | |
dimension "version" | |
buildConfigField "String", "SERVER_URL", '"http://example.demo.com/api/v1/"' | |
buildConfigField "String", "SERVER_BASE_URL", '"http://example.demo.com/"' | |
versionNameSuffix "-dev" | |
} | |
live { | |
dimension "version" | |
buildConfigField "String", "SERVER_URL", '"https://example.live.com/api/v1/"' | |
buildConfigField "String", "SERVER_BASE_URL", '"https://example.live.com/"' | |
versionNameSuffix "-live" | |
} | |
} | |
} | |
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment