hz-api-upgrade
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHorizon API Upgrade Skill
Horizon API 升级技能
When to Use
适用场景
Use this skill when:
- Upgrading an existing Quest application to a newer Horizon OS SDK version
- Fixing deprecated API warnings or compilation errors after an SDK update
- Migrating between major API versions (e.g., VrApi to OpenXR)
- Understanding what changed between SDK releases
- Planning an upgrade path for a project that has fallen behind on SDK versions
在以下场景中使用本技能:
- 将现有Quest应用升级至更新的Horizon OS SDK版本时
- SDK更新后修复废弃API警告或编译错误时
- 在主要API版本间迁移时(例如从VrApi迁移至OpenXR)
- 了解SDK版本间的变更内容时
- 为落后于SDK版本的项目规划升级路径时
General Upgrade Workflow
通用升级流程
Every SDK upgrade, regardless of platform, follows the same high-level process:
无论平台如何,所有SDK升级都遵循相同的高层流程:
1. Identify Current SDK Version
1. 识别当前SDK版本
Determine what version the project currently targets:
- Unity: Check or the Package Manager UI for
Packages/manifest.jsonpackage versionscom.meta.xr.* - Unreal: Check the Meta XR Plugin version in files or the Plugins browser
.uplugin - Spatial SDK / Android: Check or
build.gradleforbuild.gradle.ktsdependency versionscom.meta.spatial:* - Web / IWSDK: Check for
package.jsonor@meta-spatial-sdk/*package versions@iwsdk/*
确定项目当前目标的SDK版本:
- Unity:查看或Package Manager UI中的
Packages/manifest.json包版本com.meta.xr.* - Unreal:查看文件或Plugins浏览器中的Meta XR Plugin版本
.uplugin - Spatial SDK / Android:查看或
build.gradle中的build.gradle.kts依赖版本com.meta.spatial:* - Web / IWSDK:查看中的
package.json或@meta-spatial-sdk/*包版本@iwsdk/*
2. Check the API Changelog
2. 查看API更新日志
Before upgrading, review what changed between your current version and the target version. See references/api-changelog.md for a summary of recent changes.
Use the device hub to search documentation:
bash
metavr docs search "release notes v72"
metavr docs search "migration guide openxr"升级前,请查看当前版本与目标版本之间的变更内容。详见references/api-changelog.md获取近期变更摘要。
使用设备中心搜索文档:
bash
metavr docs search "release notes v72"
metavr docs search "migration guide openxr"3. Update SDK Dependencies
3. 更新SDK依赖
Update the version numbers in your project configuration:
- Unity: Update via Package Manager or edit directly
manifest.json - Unreal: Download and install the new plugin version
- Gradle projects: Bump version strings in
build.gradle - npm projects: Run or edit
npm updatepackage.json
更新项目配置中的版本号:
- Unity:通过Package Manager更新或直接编辑
manifest.json - Unreal:下载并安装新版本插件
- Gradle项目:在中提升版本字符串
build.gradle - npm项目:运行或编辑
npm updatepackage.json
4. Fix Deprecated API Calls
4. 修复废弃API调用
After updating, compile the project and address errors and warnings. See references/deprecation-guide.md for common replacements.
bash
undefined更新后,编译项目并处理错误与警告。常见替代方案详见references/deprecation-guide.md。
bash
undefinedSearch project for known deprecated APIs
在项目中搜索已知的废弃API
grep -rn "vrapi_" --include=".c" --include=".cpp" --include=".h" src/
grep -rn "OVRManager" --include=".cs" Assets/
undefinedgrep -rn "vrapi_" --include=".c" --include=".cpp" --include=".h" src/
grep -rn "OVRManager" --include=".cs" Assets/
undefined5. Test on Device
5. 设备测试
Deploy and verify functionality on a connected Quest device:
bash
metavr app install ./build/output.apk
metavr app launch com.yourcompany.yourapp部署并在已连接的Quest设备上验证功能:
bash
metavr app install ./build/output.apk
metavr app launch com.yourcompany.yourapp6. Run Performance Check
6. 性能检查
Ensure the upgrade did not introduce performance regressions:
bash
metavr perf capture确保升级未引入性能退化:
bash
metavr perf capturePlatform-Specific Upgrade Paths
平台专属升级路径
Unity: Meta XR SDK
Unity: Meta XR SDK
The Meta XR SDK for Unity is distributed as UPM packages. Upgrades are performed through the Unity Package Manager. Key packages include , , and .
com.meta.xr.sdk.corecom.meta.xr.sdk.interactioncom.meta.xr.sdk.platformSee references/sdk-migration.md for the step-by-step Unity upgrade guide.
Unity版Meta XR SDK以UPM包形式分发,通过Unity Package Manager执行升级。核心包包括、和。
com.meta.xr.sdk.corecom.meta.xr.sdk.interactioncom.meta.xr.sdk.platformUnity分步升级指南详见references/sdk-migration.md。
Unreal Engine: Meta XR Plugin
Unreal Engine: Meta XR Plugin
The Meta XR Plugin for Unreal is distributed as an engine plugin. Upgrades involve downloading the new plugin version and regenerating project files.
See references/sdk-migration.md for the step-by-step Unreal upgrade guide.
Unreal版Meta XR Plugin以引擎插件形式分发,升级需下载新版本插件并重新生成项目文件。
Unreal分步升级指南详见references/sdk-migration.md。
Android / Spatial SDK
Android / Spatial SDK
The Meta Spatial SDK is distributed as Gradle dependencies. Upgrades involve bumping version numbers in your Gradle build files.
See references/sdk-migration.md for the step-by-step Spatial SDK upgrade guide.
Meta Spatial SDK以Gradle依赖形式分发,升级需在Gradle构建文件中提升版本号。
Spatial SDK分步升级指南详见references/sdk-migration.md。
Web / IWSDK
Web / IWSDK
The Immersive Web SDK is distributed as npm packages. Upgrades involve updating package versions in .
package.jsonSee references/sdk-migration.md for the step-by-step IWSDK upgrade guide.
Immersive Web SDK以npm包形式分发,升级需更新中的包版本。
package.jsonIWSDK分步升级指南详见references/sdk-migration.md。
Common Upgrade Issues
常见升级问题
Namespace Changes
命名空间变更
Meta has progressively moved from and namespaces to namespaces. After an upgrade, you may see compilation errors due to renamed classes or moved packages.
Oculus.*OVR*Meta.*Meta已逐步从和命名空间迁移至命名空间。升级后,可能会因类重命名或包移动出现编译错误。
Oculus.*OVR*Meta.*Removed APIs
API移除
APIs that were deprecated in previous versions may be fully removed in newer versions. If you skipped intermediate upgrades, you may encounter missing symbols. Always upgrade incrementally.
在旧版本中已废弃的API可能在新版本中被完全移除。如果跳过了中间版本升级,可能会遇到符号缺失问题。请始终逐步升级。
New Required Permissions
新增必填权限
Newer Horizon OS versions may require additional permissions in your . Common additions include:
AndroidManifest.xml- for hand tracking features
com.oculus.permission.HAND_TRACKING - for passthrough camera access
horizonos.permission.HEADSET_CAMERA - New entries for feature declarations
<meta-data>
较新版本的Horizon OS可能需要在中添加额外权限,常见新增项包括:
AndroidManifest.xml- 手部追踪功能所需的
com.oculus.permission.HAND_TRACKING - 透视相机访问所需的
horizonos.permission.HEADSET_CAMERA - 用于功能声明的新条目
<meta-data>
Manifest Changes
清单文件变更
Newer SDK versions may require updated entries in , such as or updated values.
<meta-data>AndroidManifest.xmlcom.oculus.supportedDevicesminSdkVersion较新版本的SDK可能需要更新中的条目,例如或更新值。
AndroidManifest.xml<meta-data>com.oculus.supportedDevicesminSdkVersionAndroid SDK Targeting Requirement
Android SDK目标版本要求
New binary uploads for Meta Horizon apps must set within the supported range.
targetSdkVersionMeta Horizon应用的新二进制文件上传必须将设置在支持范围内。
targetSdkVersionWhat's required
要求内容
- Set to API level 32-34 for immersive apps (or 32-36 for 2D panel apps)
targetSdkVersion - can remain at API level 32
minSdkVersion - Applies to all new binary uploads for both new and existing apps
- Existing published apps continue to work without changes
- 沉浸式应用需将设置为API级别32-34(2D面板应用为32-36)
targetSdkVersion - 可保持在API级别32
minSdkVersion - 适用于新应用和现有应用的所有新二进制文件上传
- 已发布的现有应用无需修改即可继续运行
How to update
更新方式
Unity: Use the Project Setup Tool in the Meta XR SDK -- it can update API versions automatically. Or manually set in Player Settings -> Other Settings -> Target API Level.
Unreal: Use the Project Setup Tool in the Meta XR Plugin. Or set in Project Settings -> Android -> Target SDK Version.
Gradle (Spatial SDK / Native):
groovy
android {
defaultConfig {
targetSdkVersion 34 // 32-34 for immersive, 32-36 for 2D panel apps
minSdkVersion 32
}
}Unity:使用Meta XR SDK中的项目设置工具——它可以自动更新API版本。或在Player Settings -> Other Settings -> Target API Level中手动设置。
Unreal:使用Meta XR Plugin中的项目设置工具。或在Project Settings -> Android -> Target SDK Version中设置。
Gradle (Spatial SDK / Native):
groovy
android {
defaultConfig {
targetSdkVersion 34 // 沉浸式应用为32-34,2D面板应用为32-36
minSdkVersion 32
}
}Using metavr for Documentation Lookup
使用metavr查找文档
The tool provides documentation search to help during upgrades. Invoke via (published as the npm package ; if is not on PATH, run ) — no global install needed.
metavrmetavr <args>metavrmetavrnpx -y metavr <args>bash
undefinedmetavrmetavr <args>metavrmetavrnpx -y metavr <args>bash
undefinedSearch for migration-related documentation
搜索迁移相关文档
metavr docs search "migration guide"
metavr docs search "deprecated API"
metavr docs search "breaking changes v73"
metavr docs search "migration guide"
metavr docs search "deprecated API"
metavr docs search "breaking changes v73"
Search for specific API replacements
搜索特定API替代方案
metavr docs search "OVRManager replacement"
metavr docs search "vrapi openxr migration"
undefinedmetavr docs search "OVRManager replacement"
metavr docs search "vrapi openxr migration"
undefinedReferences
参考资料
- Deprecation Guide -- Common deprecated APIs and their replacements
- SDK Migration Guide -- Step-by-step platform-specific migration instructions
- API Changelog -- Summary of changes across recent SDK versions
- 废弃API指南——常见废弃API及其替代方案
- SDK迁移指南——平台专属分步迁移说明
- API更新日志——近期SDK版本变更摘要