Maps SDK for Android 版本
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google Maps Platform 团队会定期更新 SDK,以加入新功能、修复 bug 并提升性能。本页面介绍如何管理移动 SDK 的依赖项。
您要链接到哪个版本?
-
对于任务关键型应用,请链接到您所使用的主要版本的最新次要版本 (X.*),并每年升级到新的主要版本。
如果您全年发布应用的新版本,则可以使用 Maps SDK for Android 的较新次要版本。您无需更新应用,因为新的次要版本可向后兼容。
优势:
- 如果您发现了 Maps SDK for Android 中的问题,我们会根据移动平台支持政策在主要版本首次发布后 12 个月内以向后兼容的方式进行修复。您无需紧急升级到不兼容的 SDK 版本即可从修复中受益。
- 如果您已基于最新版本构建应用,可轻松采用最新的改进和功能。
- 与处理主要版本的多次发布引入的向后不兼容性更改相比,如果每年对 SDK 的最新主要版本进行增量更新,调整、重写和测试应用所需的工作量会更少。
对于非关键型应用,请链接到任何修复版本。收到该修复版本的弃用通知后,您需要在 12 个月内向用户提供更新后的应用代码。
优势:
- 降低维护频率。
- 应用的新版本对搭载旧版移动操作系统的用户设备的支持时间更长(直到您需要升级到新的 SDK 版本时)。
如果 Project Owner 拥有受监管的电子邮件地址,则会在出现对自己的每个项目产生影响的更改时收到系统的主动通知。请及时了解重大更新、弃用和其他更改。
安装
在应用级 build.gradle
文件中,请务必指定版本,而不是前缀范围 (+
) 或 latest
,否则可能会导致不可预测且不可重复的 build。Maps SDK for Android 遵循语义化版本控制,并且新的主要版本可能包含破坏性更改。支持的最低 API 级别为 19。
使用 Gradle 语法在 Google Play 服务中指定地图依赖项。
dependencies {
// Maps SDK for Android
implementation 'com.google.android.gms:play-services-maps:18.2.0'
}
请参阅有关管理 Google Play 服务版本控制的其他指南。
维护和升级
Android Studio 会自动检查是否有更新的版本,并在有更新版本的依赖项时发出警告。为了尽可能减少技术债务,请尽快更新到最新版本。如果您要更新到新的主要版本,请查看版本说明,了解向后不兼容性更改以及代码更新方法。
除了可以轮询更新的版本之外,Google Cloud 项目所有者还会收到电子邮件,通过邮件得知可能会影响其项目的向后不兼容性更改。如需获取有关向后不兼容性更改的主动通知,请为您的每个项目分配所有者角色,并提供受监管的电子邮件地址。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-06-26。
[null,null,["最后更新时间 (UTC):2024-06-26。"],[[["\u003cp\u003eGoogle Maps Platform SDKs are regularly updated with new features, bug fixes, and performance improvements.\u003c/p\u003e\n"],["\u003cp\u003eFor mission-critical apps, link to the latest dot release of the major version and upgrade yearly to ensure you receive timely fixes and benefit from the latest improvements.\u003c/p\u003e\n"],["\u003cp\u003eFor non-critical apps, link to any fixed version and update within 12 months of receiving a deprecation notice, allowing for less frequent maintenance.\u003c/p\u003e\n"],["\u003cp\u003eAlways specify a fixed version number for the Maps SDK dependency in your \u003ccode\u003ebuild.gradle\u003c/code\u003e file to ensure predictable and repeatable builds, and proactively monitor for updates and backwards-incompatible changes to minimize technical debt.\u003c/p\u003e\n"]]],["For mission-critical apps, link to the latest dot release (X.\\*) of your major version and upgrade annually. This ensures backward-compatible fixes and easier adoption of new features. Non-critical apps can use any fixed version, receiving a 12-month deprecation notice for updates. Always specify a fixed version in your `build.gradle` file to avoid unpredictable builds. Maintain updates regularly and check release notes for major version changes. Project owners receive email notifications on backwards incompatible changes.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/versions \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/versions \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/versions \"View this page for the JavaScript platform docs.\")\n\nThe Google Maps Platform team regularly updates SDKs with new features, bug fixes, and\nperformance improvements. This page provides guidance on how to manage your dependencies\non mobile SDKs.\n\nWhich version to link to?\n\n- **For mission-critical apps**, link to the latest dot release of the major\n version that you are using (X.\\*), and upgrade yearly to the new major version.\n\n As you release new versions of your application\n throughout the year, you may start using newer dot versions of the Maps SDK for Android. This will\n not require updates in your application as new dot versions are backward compatible.\n\n **Benefits:**\n - If you discover issues in the Maps SDK for Android, fixes will be provided in a backward-compatible way for 12 months after the initial release of the major version, per the [Mobile support\n policy](https://developers.google.com/maps/software-support#sdk-support). You will not need to urgently upgrade to an *incompatible* SDK version to benefit from fixes.\n - The latest improvements and features are easy to adopt when your app is already built on the latest version.\n - Annual incremental updates to the newest major version of the SDK may require less work to adapt, rewrite, and test your application, than having to handle backwards-incompatible changes introduced across multiple major version releases.\n\n \u003cbr /\u003e\n\n- **For non-critical apps**, link to any fixed version. When you receive a deprecation\n notice for that fixed version, you will have 12 months to make your updated app code available to\n your users.\n\n **Benefits:**\n - Less frequent maintenance work.\n - New versions of your app keep supporting users' devices running older mobile operating systems for longer (until you need to upgrade to a new SDK version).\n\n \u003cbr /\u003e\n\nProject Owners with monitored email addresses receive proactive notifications about changes that\nimpact each of their projects. [Stay\ninformed](https://developers.google.com/maps/support#staying_informed) about major updates, deprecations, and other changes.\n\nInstallation\n\nIn your app-level `build.gradle.kts` or `build.gradle` file, always specify\na version instead of a prefix range (`+`) or `latest` since these can lead\nto unpredictable and unrepeatable builds. The Maps SDK for Android adheres to\n[semantic versioning](https://semver.org), and new\nmajor version releases may include breaking changes. **The minimum API level supported is\n21**.\n\nSpecifying the Maps dependency within Google Play services using\n[Gradle syntax](https://docs.gradle.org/current/userguide/single_versions.html). \n\n```carbon\ndependencies {\n\n // Maps SDK for Android\n implementation(\"com.google.android.gms:play-services-maps:19.2.0\")\n}\n```\n\nSee additional guidance for\n[managing Google\nPlay services versioning](https://developers.google.com/android/guides/versioning).\n\nMaintenance and upgrade\n\nAndroid Studio automatically checks for newer available versions and provides a warning when a\nnewer version of a dependency is available. To minimize technical debt, update to the newest\navailable version as soon as possible. If you are updating to a new major version,\n[check the release notes](/maps/documentation/android-sdk/releases)\n\nfor backwards-incompatible changes and how to update your code.\n| **Note:**The minimum API level required by Maps SDK for Android version 19.0.x is Android API Level 21 (\"Lollipop\"; Android 5.0) or higher.\n\nIn addition to polling for newer versions, Google Cloud\n[project\nowners](https://cloud.google.com/iam/docs/understanding-roles#basic-definitions) receive emails about backwards incompatible changes that may\naffect their projects. To get proactive notification about backwards incompatible\nchanges, [assign\nthe owner role](https://cloud.google.com/iam/docs/granting-changing-revoking-access) with a monitored email address for each of your projects."]]