开发版本中的预览更新

了解如何使用 expo-dev-client 库在开发版本中预览已发布的 EAS 更新。


expo-dev-client 库允许通过创建开发构建来启动项目的不同版本。任何兼容的 EAS 更新都可以在开发版本中预览。

¥expo-dev-client library allows launching different versions of a project by creating a development build. Any compatible EAS Update can be previewed in a development build.

本指南介绍了使用扩展选项卡或构建特定更新 URL 在开发版本中加载和预览已发布更新所需的步骤。

¥This guide walks through the steps required to load and preview a published update inside a development build using the Extensions tab or constructing a specific Update URL.

先决条件

¥Prerequisites

什么是扩展选项卡

¥What is an Extensions tab

当在开发版本中使用 expo-updates 库时,“扩展”选项卡提供自动加载和预览已发布更新的功能。

¥When using the expo-updates library inside a development build, the Extensions tab provides the ability to load and preview a published update automatically.

使用扩展选项卡预览更新

¥Preview an update using the Extensions tab

1

Make non-native changes locally in your project and then publish them using eas update. The update will be published on a branch.

2

After publishing the update, open your development build, go to Extensions, and tap Login to log in to your Expo account within the development build. This step is required for the Extensions tab to load any published updates associated with the project under your Expo account.

3

After logging in, an EAS Update section will appear inside the Extensions tab with one or more of the latest published updates. Tap Open next to the update you want to preview.

In the Extensions tab, you can view the list of all published updates for a branch. Tap the branch name in the Extensions tab.

Preview an update using the EAS dashboard

You can also preview an update using the EAS dashboard by following the steps below:

  • Click the published updated link in the CLI after running the command to publish an update. This will open the update's details on the Updates page in the EAS dashboard.
  • Click Preview. This will open the Preview dialog.
  • To preview the update, you can either scan the QR code with your device's camera or select a platform to launch the update under Open with Orbit.

Construct an update URL

As an alternative to the methods described in the previous sections, you can construct a specific URL to open your EAS Update in the development build. The URL will look like the following:

Terminal
[slug]://expo-development-client/?url=[https://u.expo.dev/project-id]/group/[group-id]
# Examplemy-app://expo-development-client/?url=https://u.expo.dev/675cb1f0-fa3c-11e8-ac99-6374d9643cb2/group/47839bf2-9e01-467b-9378-4a978604ab11

让我们分解此 URL 以了解每个部分的作用:

¥Let's break this URL to understand what each part does:

URL 的一部分描述
slug在应用配置中找到项目的 slug
://expo-development-client/深层链接与 expo-dev-client 库一起使用所必需的。
?url=定义 url 查询参数。
https://u.expo.dev/675cb1f0-fa3c-11e8-ac99-6374d9643cb2这是更新 URL,位于 updates.url 下的项目应用配置内。
/group/47839bf2-9e01-467b-9378-4a978604ab11更新的组 ID。

构建 URL 后,将其直接复制并粘贴到手动输入 URL 下的开发构建启动器屏幕中。

¥Once you've constructed the URL, copy and paste it directly into the development build's launcher screen under Enter URL Manually.

或者,你可以使用设备的相机 为 URL 创建二维码 并进行扫描。扫描后,URL 将打开指定通道的开发版本。

¥Alternatively, you can create a QR code for the URL and scan it using your device's camera. When scanned, the URL will open up the development build to the specified channel.

示例

¥Example

查看工作示例

See a working example of using expo-dev-client with EAS Update.