升级到最新版本的 Wear OS
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
从 Wear 2.0 升级
本指南介绍了 Wear OS 的升级流程。
特定于 Android 的更改
Wear 2.0 包含 API 级别为 25 至 28 的多个 Android 版本。
注意:没有适用于 Android 10(API 级别 29)的 Wear OS 版本。
如果您的 Wear OS 应用以 Wear OS 2.0(API 级别 28)为目标平台,那么大部分升级工作是处理从 Android 9(API 级别 28)到 Android 11(API 级别 30)的平台更改。
没有适用于 Android 10(API 级别 29)的 Wear OS 版本,因此,当您将 compileSdkVersion
和 targetSdkVersion
字段从 28 更改为 30 时,您需要一次性处理所有这些更改。
注意:即使您不更改应用的 compileSdkVersion
或 targetSdkVersion
,也请确保应用兼容 API 级别 29。
特定于 Wear OS 的更改
Wear OS 2.0 中存在功能块、复杂功能、应用、表盘主题和许多其他 surface。升级您的应用时,您必须修改界面,以遵从最新的设计准则。
此外,API 级别 30 包含 Ongoing Activity API。持续性活动可让持续性通知显示在 Wear OS 界面内的其他 surface 中,这样,用户就可以与长时间进行的活动保持更高的互动度。
注意:Alpha 版表盘主题 API 的某些功能仅在 API 级别为 30 或更高的设备上可用。
选择起始版本
大多数开发者都致力于构建目标 API 级别为 30 的可靠应用,并保持较低的 minSdkVersion
版本,以便以最常见的 Android 版本为目标平台。例如,如需支持 Wear 2.0 设备,请将 minSdkVersion
设置为 25。
如果您有 Android 开发经验,那么这些知识大部分都适用于 Wear OS。
如需了解两者之间的差异,请参阅 Wear OS 应用开发与移动应用开发。
注意:API 级别为 30 的 Wear OS 模拟器系统映像目前为开发者预览版。如需了解最新更新,请参阅版本说明。
适用于 Wear OS 的 Jetpack 库
适用于 Wear OS 的 Jetpack 库是一组库,其中包含的功能与穿戴式设备支持库类似,并且能更好地支持 Wear OS 3。
适用于 Wear OS 的 Jetpack 库可用于替代穿戴式设备支持库,而非与这类库搭配使用。穿戴式设备支持库不适用于 Wear OS 3。
如需了解详情,请参阅博文 Wear OS Jetpack 库现已稳定。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[],[],null,["# Upgrade to the latest version of Wear OS\n\nUpgrade from Wear 2.0\n---------------------\n\n\nThis guide describes the upgrade process for Wear OS.\n\n### Android-specific changes\n\n\nWear 2.0 encompasses multiple Android versions, from API level 25 through\nAPI level 28.\n\n**Note:** There is no version of Wear OS for Android 10 (API Level 29).\n\n\nIf your Wear OS app targets Wear OS 2.0 (API level 28), then most of the work\nto upgrade is handling the platform changes from Android 9 (API level 28) to\nAndroid 11 (API level 30).\n\nThere is no version of Wear OS for Android 10 (API Level 29), you need to handle those\nchanges all at once when you change your `compileSdkVersion` and\n`targetSdkVersion` fields from 28 to 30.\n\n**Note:** Even if you don't change the `compileSdkVersion` or\n`targetSdkVersion` in your app, ensure that your app is\n[compatible](https://developer.android.com/about/versions/11/migration#compat) with API Level 29.\n\n### Changes specific to Wear OS\n\n\n[Tiles](/training/articles/wear-tiles),\n[complications](/training/wearables/watch-faces/complications),\napps, [watch faces](/training/wearables/watch-faces), and many other surfaces\nexist in Wear OS 2.0. When you upgrade your app, you must revise your user interfaces\nto incorporate the latest design guidelines.\n\n\nAlso, API level 30 includes the\n[Ongoing Activity API](/reference/androidx/wear/ongoing/OngoingActivity).\nAn [ongoing activity](/training/wearables/ongoing-activity) lets an\nongoing notification appear on additional surfaces within the Wear OS user\ninterface, which lets users stay more engaged with long-running activities.\n\n**Note:** Some features of alpha watch face APIs are available only on\ndevices running API level 30 or higher.\n\nChoose a version to start with\n------------------------------\n\n\nMost developers build a solid app that targets API level 30 and\nleave the `minSdkVersion` version low enough to target the most prevalent Android\nversions. For example, to enable support for Wear 2.0 devices, set your `minSdkVersion`\nto 25.\n\n\nIf you have experience with Android development, much of that knowledge is applicable to Wear OS.\nTo find out what differs, read\n[Wear OS versus mobile development](/training/wearables/wear-v-mobile).\n\n\n**Note** : The API level 30 Wear OS emulator system image is in Developer\nPreview. See the\n[release notes](https://androidstudio.googleblog.com/2021/05/android-studio-arctic-fox-beta-1.html)\nfor the latest updates.\n\nJetpack libraries for Wear OS\n-----------------------------\n\n\nThe [Jetpack libraries for Wear OS](/jetpack/androidx/releases/wear) are a set of\nlibraries that contain similar functionality to the Wearable Support library and better support\nfor Wear OS 3.\n\n\nThe Jetpack libraries for Wear OS are replacements for the Wearable Support Library and aren't\ndesigned to be used together. The Wearable Support Library does not work on Wear OS 3.\n\n\nFor more information, see the blog post\n[Wear OS Jetpack libraries now in stable](https://android-developers.googleblog.com/2021/09/wear-os-jetpack-libraries-now-in-stable.html)."]]