【笔记】Android Gradle Plugin配置文件相关说明-libs.versions.toml
版本号
文件路径:Project\gradle\libs.versions.toml
直接搜索versions.agp是找不到的,这是变量引用的写法,查询 agp版本可以直接查版本号。
[versions]
agp = "8.5.0-alpha08"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
appcompat = "1.6.1"
material = "1.10.0"
constraintlayout = "2.1.4"
navigationFragment = "2.6.0"
navigationUi = "2.6.0"[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment", version.ref = "navigationFragment" }
navigation-ui = { group = "androidx.navigation", name = "navigation-ui", version.ref = "navigationUi" }[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
libs.versions.toml
文件是一个用来集中管理项目依赖版本的配置文件,这是Gradle 7及更高版本中引入的一个新功能,部分基于版式文件(Version Catalogs)的概念。该文件允许在一个单独的文件中定义所有的依赖库以及它们的版本号,这样做的目的是为了简化和集中管理项目中的依赖,使得依赖版本的更新和维护变得更加直观和便捷。
[versions]
部分定义了项目中用到的所有库的版本号。[libraries]
部分定义了依赖项的坐标以及它们所引用的版本。[plugins]
部分允许定义Gradle插件及其版本。