Maps SDK for Android 版本
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google 地圖平台團隊會定期更新 SDK,加入新功能、修正錯誤及改善執行效能。本頁內容說明如何透過行動 SDK 管理依附元件。
要連結哪個版本?
-
如果是重要業務應用程式,請連結至目前使用的主要版本中最新的次要版本 (X.*),然後每年升級至新的主要版本。
如果全年陸續發布新版應用程式,您可以開始使用較新的 Maps SDK for Android 次要版本。這種做法不需要更新應用程式,因為新的次要版本具有回溯相容性。
優點:
- 根據行動裝置支援政策,如果您在 Maps SDK for Android 中發現問題,在主要版本首次發布後的 12 個月內,我們會以回溯相容的方式提供修正內容。您無須立即升級至不相容的 SDK 版本,即可進行修正。
- 如果您已在最新版本中建構應用程式,便可輕鬆採用最新改善項目和功能。
- 相較於處理多次發布主要版本時造成的回溯不相容性變更,每年更新 SDK 最新主要版本的做法,在調整、重寫及測試應用程式方面所需的作業量較少。
如果是非重要應用程式,請連結至任何修正版本。收到該修正版本的淘汰通知後,您必須在 12 個月內向使用者提供新版應用程式的程式碼。
優點:
- 維護作業頻率降低。
- 針對執行舊版行動作業系統的使用者裝置,新版應用程式持續提供支援的時間較長 (可持續到您必須升級至新版 SDK 為止)。
相關變更影響到各項專案時,電子郵件地址有人監管的專案擁有者會收到主動通知。隨時掌握重大更新、淘汰項目和其他異動。
安裝
在應用程式層級的 build.gradle
檔案中,請一律指定版本,而不使用前置字串範圍 (+
) 或 latest
,因為這麼做可能導致系統產生無法預測且不可重複的版本。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 專案擁有者也會收到通知電子郵件,說明回溯不相容性變更對專案可能造成的影響。如要取得與回溯不相容性變更相關的主動通知,請在每個專案中使用可監控的電子郵件地址指派擁有者角色。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-06-26 (世界標準時間)。
[null,null,["上次更新時間: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."]]