Created
October 21, 2021 06:32
-
-
Save Kashif-E/80b4d91856d3ab10565e40579d802b4b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def final packageId = "com.app" | |
def versionPropFile = rootProject.file('version.properties') | |
def versionProps = new Properties() | |
versionProps.load(new FileInputStream(versionPropFile)) | |
android { | |
compileSdkVersion 31 | |
buildToolsVersion "30.0.3" | |
defaultConfig { | |
applicationId packageId | |
minSdkVersion 21 | |
targetSdkVersion 31 | |
versionCode 11 | |
versionName "2.1.5" | |
buildTypes { | |
debug { | |
debuggable true | |
multiDexEnabled true | |
minifyEnabled false | |
useProguard false | |
shrinkResources false | |
manifestPlaceholders = [crashlyticsCollectionEnabled: 'true', analyticsEnabled: 'false'] | |
} | |
release { | |
debuggable false | |
minifyEnabled false | |
manifestPlaceholders = [crashlyticsCollectionEnabled: 'true', analyticsEnabled: 'true'] | |
multiDexEnabled true | |
useProguard true | |
shrinkResources false | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'] | |
} | |
} | |
signingConfigs { | |
release { | |
storeFile file('..\\keystore.jks') | |
storePassword | |
keyPassword | |
keyAlias = 'key0' | |
} | |
} | |
flavorDimensions "version" | |
productFlavors { | |
dev { | |
buildConfigField "String", "RELEASE_TYPE", "\"dev\"" | |
versionNameSuffix ".${versionProps['INTERNAL_VERSION_CODE']}-dev" | |
resValue "string", "app_name", "Dev" | |
applicationIdSuffix ".dev" | |
signingConfig signingConfigs.release | |
} | |
qa { | |
buildConfigField "String", "RELEASE_TYPE", "\"qa\"" | |
versionNameSuffix ".${versionProps['INTERNAL_VERSION_CODE']}-qa" | |
resValue "string", "app_name", "QA" | |
applicationIdSuffix ".qa" | |
signingConfig signingConfigs.release | |
} | |
prod { | |
buildConfigField "String", "RELEASE_TYPE", "\"prod\"" | |
resValue "string", "app_name", "app name" | |
signingConfig signingConfigs.release | |
} | |
uat { | |
buildConfigField "String", "RELEASE_TYPE", "\"uat\"" | |
resValue "string", "app_name", "UAT" | |
signingConfig signingConfigs.release | |
applicationIdSuffix ".uat" | |
} | |
demo { | |
buildConfigField "String", "RELEASE_TYPE", "\"demo\"" | |
resValue "string", "app_name", "Demo" | |
signingConfig signingConfigs.release | |
} | |
} | |
lintOptions { | |
checkReleaseBuilds true | |
abortOnError false | |
} | |
applicationVariants.all { variant -> | |
if (variant.buildType.name == 'release') { | |
variant.assemble.doLast { | |
def code = versionProps['INTERNAL_VERSION_CODE'].toInteger() + 1 | |
versionProps['INTERNAL_VERSION_CODE'] = code.toString() | |
versionProps.store(versionPropFile.newWriter(), null) | |
} | |
} | |
variant.outputs.all { | |
def formattedDate = new Date().format('yyyy_MM_dd') | |
def versionName = variant.versionName | |
outputFileName = "app_${versionName}_${formattedDate}.apk" | |
} | |
} | |
ndk { | |
// abiFilters "armeabi-v7a", "x86","x86-64" | |
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' | |
// abiFilters 'arm64-v8a','x86_64' | |
} | |
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |
} | |
buildTypes { | |
release { | |
minifyEnabled false | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
} | |
} | |
compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
targetCompatibility JavaVersion.VERSION_1_8 | |
} | |
kotlinOptions { | |
jvmTarget = '1.8' | |
} | |
buildFeatures { | |
dataBinding true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment