如何获得 Android 的最新版本的 ConstraintLayout?

How can I get the latest version of ConstraintLayout for Android?

当我尝试在布局 content_main.xml 中使用 ConstraintLayout 时,我收到以下消息:

Using version 1.0.0-alpha5 of the constraint library, which is obsolete

我目前正在使用以下库依赖项:

compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha5'

如何获取约束布局的最新版本号?

编辑: 现在我们直接在maven上发布ConstraintLayout,你可以查看maven目录:

https://dl.google.com/dl/android/maven2/com/android/support/constraint/group-index.xml


在 Android Studio 中查看 SDK 管理器。如果您检查 SDK 工具部分中的 "Show Package Details",您应该会看到 ConstraintLayout 的所有可用版本(在 Support Repository -> ConstraintLayout for Android 下)

Google终于发布了1.1.0正式版ConstraintLayout 所以你现在可以导入非测试版

compile 'com.android.support.constraint:constraint-layout:1.1.0'

点击这里了解更多信息 http://tools.android.com/recent/constraintlayout10isnowavailable

直接拉入ConstraintLayout

检查 the Maven repository 以获取最新版本。使用完整的版本名称(例如 2.0.0-beta2)。

向目标模块添加依赖项:

target_module/build.gradle

如果使用支持包:

android {
  ...
}

dependencies {
  ...
  implementation `com.android.support.constraint:constraint-layout:some-version-number`
}

如果使用 androidx 包:

android {
  ...
}

dependencies {
 implementation 'androidx.constraintlayout:constraintlayout:some-version-number'
}

可以找到 2.0.0-alpha5 的确切 Gradle 行 in the official release announcement

ConstraintLayout 包含在新的(ish)AndroidX 版本页面中。这里直接link按track(alpha, beta, rc, stable)查看最新版本的ConstraintLayout:

https://developer.android.com/jetpack/androidx/releases/constraintlayout

当前视图: