库版本
从 15.0.0 版开始,系统会维护 Google Play 服务库
这使得每个库的开发团队都能发布修复程序
且更快的速度你可以跟踪
Google Play 服务和
Firebase。
严格版本匹配
一个库的某个版本可能与
另一个库。为帮助处理这种情况,几个 Gradle 插件提供了
有关这些版本不匹配问题的指导。这些插件中的逻辑是
类似于 failOnVersionConflict()
规则中的逻辑,
ResolutionStrategy
与 Google Play 服务和 Firebase 依赖项相关联的应用。
Google 服务插件
Google 服务 Gradle 插件
检查 Google Play 服务和 Firebase 库的兼容版本。
独立版本匹配器插件
如果您未使用 Google 服务插件,但仍想严格遵守
对依赖项进行版本检查,则可以将
[strict-version-matcher-plugin
].您可以查看此插件的
代码。
以下代码段展示了如何添加 Gradle 插件:
Kotlin DSL
build.gradle.kts
plugin {
id("com.google.android.gms.strict-version-matcher-plugin")
}
时尚 DSL
build.gradle
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'
要使用此插件,您还需要将以下内容添加到
buildscript 类路径,从 Google 的 Maven
代码库:
Kotlin DSL
build.gradle.kts
classpath("com.google.android.gms:strict-version-matcher-plugin:1.2.4")
时尚 DSL
build.gradle
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.4'
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-09。
[null,null,["最后更新时间 (UTC):2024-09-09。"],[[["Google Play services libraries are now individually maintained, allowing for faster and more frequent updates to individual components."],["Strict version matching is crucial as library versions might be incompatible, and the Google Services Gradle plugin and the standalone strict-version-matcher-plugin help manage these dependencies."],["The `strict-version-matcher-plugin` offers a way to ensure version compatibility for Google Play services and Firebase dependencies, even without using the Google Services plugin."],["To utilize the standalone plugin, you need to add it to your buildscript classpath and apply it in your Gradle file using the provided code snippets."]]],["Google Play services libraries are individually maintained, enabling faster updates. To manage potential version incompatibilities between libraries, Gradle plugins provide guidance. The Google Services Gradle plugin checks for compatible versions of Google Play services and Firebase libraries. Alternatively, the `strict-version-matcher-plugin` offers dependency version checking without the Google Services plugin. To use it you must add the plugin and the `strict-version-matcher-plugin` classpath to your build script.\n"]]