Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 470 Bytes

自定义Apk名称.md

File metadata and controls

18 lines (13 loc) · 470 Bytes

Kotlin DSL 自定义Apk输出名称

app build.gradle.kts

defaultConfig {
  setProperty("archivesBaseName", "tv-$versionName-$versionCode-${Versions.date()}")
}

Versions.kt

//don't do that , will be throw file not found exception
SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(Date())

object Versions {
    @Suppress("SimpleDateFormat")
    fun date(): String {
    return SimpleDateFormat("yyyy-MM-dd").format(Date())
}