开发版本中的预览更新

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


For the complete documentation index, see llms.txt. Use this file to discover all available pages.

[expo-dev-client](/develop/development-builds/introduction/) 库允许通过创建开发版本来启动不同版本的项目。任何兼容的 EAS 更新都可以在开发版本中预览。

本指南介绍了如何在开发版本中使用 扩展 选项卡或构建特定更新 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

2 requirements

1.

已安装开发版本

创建一个开发版本并将其安装 到你的设备、Android 模拟器或 iOS 模拟器上。

2.

expo-updates 已安装

确保你的开发版本已经安装了 expo-updates

什么是扩展选项卡

🌐 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

在你的项目中本地进行非本地更改,然后使用 eas update 发布它们。更新将发布在一个分支上。

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

2

发布更新后,打开你的开发版本,进入 扩展,然后点击 登录 在开发版本中登录你的 Expo 账户。此步骤是必须的,以便 扩展 标签可以加载与你的 Expo 账户下项目相关的任何已发布更新。

🌐 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

登录后,在 扩展 标签中会出现一个 EAS 更新部分,其中包含一个或多个最新发布的更新。点击你想要预览的更新旁的 打开

🌐 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.

使用 EAS 仪表板预览更新

🌐 Preview an update using the EAS dashboard

你也可以通过以下步骤在 EAS 控制面板上预览更新:

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

  • 在运行发布更新的命令后,点击 CLI 中已发布的更新链接。这将打开 EAS 仪表板中 更新 页面上的更新详情。
  • 点击 预览。这将打开 预览 对话框。
  • 要预览更新,你可以使用设备的摄像头扫描二维码,或选择一个平台来通过 Open with Orbit 启动更新

构建更新网址

🌐 Construct an update URL

作为前面各节中描述的方法的替代方案,你可以构建一个特定的 URL 在开发版本中打开你的 EAS 更新。该 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.

或者,你可以为该网址创建二维码,并使用设备的相机扫描。当扫描后,该网址将打开指定渠道的开发版本。

🌐 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

查看工作示例

查看一个使用 expo-dev-client 和EAS更新的工作示例。