首页指南参考教程

如何发布更新

了解如何使用 EAS Update 发布更新。


发布更新允许:

¥Publishing an update allows:

  • 修复错误并快速更新项目的非原生部分,而不是创建新版本

    ¥Fixing bugs and quickly updating non-native parts of a project instead of creating a new build

  • 共享应用的预览版本 使用内部分发

    ¥Sharing a preview version of an app using internal distribution

本指南介绍了发布更新所需的步骤、其工作原理以及测试方法。

¥This guide explains the steps required to publish an update, how it works, and methods to test it.

发布更新

¥Publish an update

要发布包含项目更改的更新,你可以使用 eas update 命令,并为 branchmessage 指定名称来描述更新:

¥To publish an update with changes from your project, you can use the eas update command, and specify a name for the branch and a message to describe the update:

Terminal
eas update --branch [branch-name] --message "[message]"

如何发布更新

¥How does publishing an update work

当你使用 eas update 命令发布更新时,它会生成一个新的更新包并将其上传到 EAS 服务器。branch 名称用于标识更新并与上传的包相关联。它类似于 Git 提交的工作方式,其中每个提交都与一个 Git 分支相关联。

¥When you publish an update with the eas update command, it generates a new update bundle and uploads it to the EAS servers. The branch name is used to identify the update and is associated with the uploaded bundle. It is similar to how Git commit works, where every commit is associated with a Git branch.

例如,你想要发布 development 构建配置文件 的更新。你可以将其用作分支名称,以将更新与其构建配置文件关联起来。当应用请求更新时,它将下载与 development 分支关联的更新。

¥For example, you want to publish an update for the development build profile. You can use it as the branch name to associate the update with its build profile. When the app requests an update, it will download the update associated with the development branch.

对于此示例,发布带有 development 分支和消息的更新的命令是:

¥For this example, the command to publish an update with the development branch and a message is:

Terminal
eas update --branch development --message "Fixes typo"

上述命令在后台运行 npx expo export 以生成 dist 目录并创建本地更新包。此更新包已上传到 EAS 更新服务器。

¥The above command runs npx expo export behind the scenes to generate a dist directory and create a local update bundle. This update bundle is uploaded to EAS Update servers.

EAS 更新工作原理的深入指南

深入了解并了解 EAS 更新的工作原理。

测试已发布的更新

¥Testing a published update

将更新上传到 EAS Update 后,你可以使用以下方法之一来测试更新:

¥After the update is uploaded to EAS Update, you can use one of the following methods to test the update:

  • 使用 开发构建 中的扩展选项卡加载更新。

    ¥Use the Extensions tab in a development build to load the update.

  • 使用 Expo 轨道 在开发版本中安装和启动更新。

    ¥Use Expo Orbit to install and launch the update in a development build.

  • 使用 更新 API应用配置 实现自定义策略,以编程方式在应用中加载更新。

    ¥Implement a custom strategy with Updates API and app config to load updates in the app programmatically.

  • 通过强制关闭并重新打开应用的发布版本最多两次来下载和应用更新,手动测试更新。

    ¥Manually test the update by force closing and reopening a release build of your app up to two times to download and apply the update.

当应用启动并请求任何新更新时,非开发版本(预览或生产)的更新会自动下载到设备。

¥Updates for non-development builds (preview or production) are automatically downloaded to the device when the app starts up and makes a request for any new updates.

故障排除

¥Troubleshooting

如果你的应用未按预期更新,请参阅以下调试指南以了解验证配置的技术:

¥If your app is not updating as expected, see the following debugging guides for techniques to validate your configuration:

调试 EAS 更新

了解如何排除故障和调试 EAS Update。

高级 EAS 更新调试

了解调试 EAS 更新的高级策略。

Expo 中文网 - 粤ICP备13048890号