迁移对 Android X 的支持:各模块的版本是否一致?

Migrating support to Android X: Are versions consistent across Modules?

我正在将一个大项目迁移到 AndroidX。

在我以前的项目中,在顶部 build.gradle,我定义了一个带有支持库版本的变量,因此 30+ child build.gradle 包含所需的支持版本:

ext {
    supportLibraryVersion = "28.0.0"
    buildToolsVersion = "28.0.3"
    googleServicesVersion = "15.0.0"
}

我的问题是,既然我有 运行 Android X 重构,我看到依赖项已转换为 Android X 命名空间下的不同包 甚至脱离它:

    implementation "androidx.appcompat:appcompat:1.0.0'
    implementation "androidx.percentlayout:percentlayout:1.0.0"
    implementation 'androidx.palette:palette:1.0.0'
   implementation 'com.google.android.material:material:1.0.0'

我的问题是,如果现在使用 Android X,所有模块版本都是同步的,那么在顶部 gradle:

做是有意义的
ext {
    androidXLibraryVersion = "x.x.x"
}

我的猜测是 Android X 命名空间之外的模块会有自己的版本时间表,但我什至不确定 AndroidX 命名空间下的模块是否会使用通用版本。

你怎么看?

在 AndroidX 世界中,每个组(即第一个 : 之前的部分,例如 androidx.appcompat)可以根据 AndroidX Overview 有一个单独的版本:

Unlike the Support Library, AndroidX packages are separately maintained and updated. The androidx packages use strict Semantic Versioning starting with version 1.0.0. You can update AndroidX libraries in your project independently.

正如在 AndroidX releases page 上看到的那样,它们确实以不同的速度进行升级,但语义版本控制要求确保库的稳定版本将继续协同工作。