CI/CD/Jenkins
[ Jenkins ] ANDROID APK 자동배포
loopinger
2023. 2. 6. 20:12
※ 안드로이드 프로젝트 [ gradle.build ] 파일 설정
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
String APK_NAME = "androidProject"
static def getDate()
{
def date = new Date()
def formattedDate = date.format('yyyyMMdd_HHmmssS')
return formattedDate
}
android {
compileSdk 33
defaultConfig {
applicationId "com.android.project"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
}
signingConfigs
{
release
{
storeFile file("/app/cert/android/android.jks")
storePassword "P@ssw0rd!"
keyAlias "key0"
keyPassword "P@ssw0rd!"
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
def newName = APK_NAME
newName += "-" + defaultConfig.versionName
if (variant.buildType.name == "SNAPSHOT")
{
newName += "-" + getDate()
}
newName += "-" + variant.buildType.name
outputFileName = new File("./../../../../../build/", newName + ".apk")
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
SNAPSHOT {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_15
targetCompatibility JavaVersion.VERSION_15
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
}