#Andriod #Dev #Tip
#Performance #Optimization
The Version Catalog is a mechanism introduced in Gradle to provide a simple way to centrally manage version numbers for applications and libraries. With the Version Catalog, you can define and maintain all the version numbers for your applications and libraries, and then reference these version numbers throughout your project. This ensures that all the libraries and components used in the project are using the same version numbers, reducing errors and compatibility issues caused by version conflicts.
Definition#
gradle/libs.versions.toml
[versions]
kotlin = "1.8.10"
[libraries]
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" version.ref = 'kotlin' }
[bundles]
app = [
"kotlin-stdlib-jdk8"
]
lib = [
"kotlin-stdlib-jdk8"
]
Usage#
- app/build.gradle
dependencies {
implementation libs.bundles.app
}
- lib/build.gradle
dependencies {
implementation libs.bundles.lib
}
Ref#
https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog