샘플 코드 : https://github.com/Pluu/VersionCodeUpdaterSample
// app/build.gradle.kts
android {
defaultConfig {
versionCode = 1 // 적용되는 Version Code
}
}
// app/build.gradle.kts
android {
defaultConfig {
versionCode = 1
}
flavorDimensions += "version"
productFlavors {
create("demo") {
dimension = "version"
versionCode = 1234 // 최종 적용되는 Version Code
}
}
}
// app/build.gradle.kts
android {
defaultConfig {
versionCode = 1
}
flavorDimensions += "version"
productFlavors {
create("demo") {
dimension = "version"
versionCode = 3
}
}
}
androidComponents {
finalizeDsl {
it.defaultConfig.versionCode = 2
}
onVariants { variant ->
variant.outputs.forEach { output ->
output.versionCode.set(1234) // 최종 적용되는 Version Code
}
}
}
방법 4에서 적용되는 Version Code가 순서
1
적용2
적용3
적용1234
적용
comments powered by Disqus
Subscribe to this blog via RSS.