본문 바로가기

AOS - Kotlin

[android/kotlin] apk 이름 변경

반응형
SMALL

build.gradle(:app) 에서

 

import java.text.SimpleDateFormat

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

def getDate() {
    return new SimpleDateFormat("yyyyMMdd").format(new Date())
}
def buildDate = getDate()
def nameOfApp = "APP_NAME"

android {
    namespace 'com.APP_NAME'
    compileSdk 34

    defaultConfig {
        ...
        versionCode 1
        versionName "1.0.0"

        setProperty("archivesBaseName", nameOfApp + "_v" + versionName + "(" + versionCode + ")_" + buildDate)

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    ...
}

 

 

apk 이름 APP_NAME_v1.0.0(1)_20240304-debug.apk 으로 만들어짐

반응형
LIST