This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

内部分发

了解 EAS Build 如何为你的构建提供可与你的团队共享的 URL,以便进行内部分发。


使用 EAS Build 设置内部分发构建只需几分钟,并提供了一种简化的方式,让你可以将应用与团队和其他测试人员共享以获取反馈。它通过提供一个 URL,使他们能够直接将应用安装到设备上。如果你尚不确定是否要使用这种方法,并且想了解用于内部分发应用的所有可用选项,请参阅应用分发审核概览指南。

🌐 Setting up an internal distribution build only takes a few minutes with EAS Build and provides a streamlined way to share your app with your team and other testers for feedback. It does this by providing a URL that allows them to install the app directly to their device. If you are not sure yet if you want to use this approach and want to learn about all of the options available for distributing your app internally, refer to the overview of distribution apps for review guide.

使用内部分发

🌐 Using internal distribution

要为内部分发配置构建配置文件,请在其上设置 "distribution": "internal"。当你设置此配置时,它会对构建配置文件产生以下影响:

🌐 To configure a build profile for internal distribution, set "distribution": "internal" on it. When you set this configuration, it has the following effects on the build profile:

  • AndroidgradleCommand 的默认行为将更改为生成 APK 而不是 AAB。如果你指定了自定义的 gradleCommand,请确保它生成 APK,否则无法直接安装到 Android 设备上。此外,EAS Build 将生成一个新的 Android 签名密钥库来签署 APK,如果包名与你的开发构建相同,则会使用现有密钥库。
  • iOS:使用此配置文件构建的应用将使用Ad Hoc 或企业配置。在使用 Ad Hoc 配置时,EAS Build 会生成一个包含设备 UDID 允许列表的配置文件,只有构建时列表中的设备才能安装它。你可以通过运行 eas device:create 创建新构建来添加设备。
  • 默认情况下,内部分发构建的 URL 对任何拥有该 URL 的人都是可用的,每个 URL 都由 32 个字符的 UUID 标识。如果你希望访问这些构建时需要登录到授权的 Expo 账户,可以在你的 项目设置 中禁用 对内部构建的未认证访问 选项。

有关如何配置、创建和安装构建的更多信息,请参阅下面有关使用 EAS Build 进行内部分发的教程:

🌐 See the tutorial on Internal distribution with EAS Build below for more information on how to configure, create, and install a build:

创建并共享内部发行版本

使用 EAS Build 设置和共享内部分发构建的完整分步指南。

CI 自动化(可选)

🌐 Automation on CI (optional)

你可以在 CI 中使用 --non-interactive 标志非交互地运行内部分发构建。了解更多关于从 CI 触发构建的信息

🌐 You can run internal distribution builds non-interactively in CI with the --non-interactive flag. Learn more about triggering builds from CI.

对于 iOS 临时构建,eas build --non-interactive 会重复使用有效的配置描述文件而不更新其设备列表。构建可能成功,但应用可能无法安装在配置文件最后一次更新后新增的注册设备上。

🌐 For iOS ad hoc builds, eas build --non-interactive reuses a valid provisioning profile without updating its device list. The build can succeed, but the app may not install on registered devices added after the profile was last updated.

在构建之前,将 --refresh-ad-hoc-provisioning-profile--non-interactive 一起传递,以更新 Apple 开发者门户上由 Expo 管理的临时配置描述文件。

🌐 Pass --refresh-ad-hoc-provisioning-profile with --non-interactive to update the Expo-managed ad hoc provisioning profile on the Apple Developer Portal before the build.

信息 --refresh-ad-hoc-provisioning-profile 需要 EAS CLI 19.1.0 或更高版本。

EAS 使用 App Store Connect API 密钥进行身份验证。它读取 EAS 上为你的 Apple 团队注册的设备。它会在门户中注册任何缺失的 UDID。然后,它会刷新配置文件设备列表。

🌐 EAS authenticates with an App Store Connect API key. It reads devices registered on EAS for your Apple team. It registers any missing UDIDs on the portal. Then it refreshes the profile device list.

当你使用此标志时,EAS 会为构建目标的 Apple 平台选择所有匹配的设备:iOS 的 iPhone 和 iPad,macOS 的 Mac。

🌐 When you use this flag, EAS selects all matching devices for the build target's Apple platform: iPhone and iPad for iOS, Mac for macOS.

Terminal
eas build --platform ios --profile preview --non-interactive --refresh-ad-hoc-provisioning-profile

对于 EAS 工作流,在构建作业的 params 中设置 refresh_ad_hoc_provisioning_profile: true,并使用相同的配置文件要求。请参阅 构建作业参数

🌐 For EAS Workflows, set refresh_ad_hoc_provisioning_profile: true in the build job's params with the same profile requirements. See the build job parameters.

该配置文件必须设置 "distribution": "internal" 并使用 EAS 管理的凭证。你至少需要一台来自 eas device:create 的设备,以及在 CI 中通过 环境变量 (EXPO_ASC_API_KEY_PATHEXPO_ASC_KEY_IDEXPO_ASC_ISSUER_ID) 或存储在 EAS 中的密钥,用于项目的提交,来使用 App Store Connect API 密钥。

🌐 The profile must set "distribution": "internal" and use credentials managed by EAS. You need at least one device from eas device:create and an App Store Connect API key in CI through environment variables (EXPO_ASC_API_KEY_PATH, EXPO_ASC_KEY_ID, and EXPO_ASC_ISSUER_ID) or a key stored in EAS for submissions on the project.

否则,在使用 eas device:create 注册设备后,请交互式运行 eas build 并使用你的 Apple 账户登录,以便 EAS 可以更新临时配置文件。

🌐 Otherwise, after registering a device with eas device:create, run eas build interactively and sign in with your Apple account so EAS can update the ad hoc provisioning profile.

管理设备

🌐 Managing devices

使用 EAS 工作流程,你可以暂停工作流程,直到测试人员注册 iOS 设备并且团队成员使用 apple-device-registration-request 作业批准该设备。将其与 build 作业配对,该作业设置 refresh_ad_hoc_provisioning_profile: true 以将新设备包含在内部分发构建中。

🌐 With EAS Workflows, you can pause a workflow until a tester enrolls an iOS device and a team member approves it using the apple-device-registration-request job. Pair it with a build job that sets refresh_ad_hoc_provisioning_profile: true to include the new device in an internal distribution build.

你可以通过运行以下命令查看通过 eas device:create 注册的任何设备:

🌐 You can see any devices registered via eas device:create by running:

Terminal
# List devices registered for ad hoc provisioning
eas device:list

通过 Expo 为临时分发注册的设备,在使用 EAS Build 为新的内部构建生成配置描述文件,或使用 eas build:resign 对现有构建进行重新签名 后,将会出现在你的 Apple 开发者门户中。

🌐 Devices registered with Expo for ad hoc provisioning will appear on your Apple Developer Portal after they are used to generate a provisioning profile for a new internal build with EAS Build or to resign an existing build with eas build:resign.

删除设备

🌐 Remove devices

如果不再使用某个设备,可以通过运行以下命令将其从该列表中删除:

🌐 If a device is no longer in use, it can be removed from this list by running:

Terminal
# Delete devices from your Expo account, optionally disable them on the Apple Developer Portal
eas device:delete

This command will also prompt you to disable the device on the Apple Developer Portal. Disabled devices still count against Apple's limit of 100 devices for ad hoc distribution per app.

重命名设备

🌐 Rename devices

通过网站 URL/二维码添加的设备在选择用于 EAS 构建时默认会显示其 UDID。你可以使用以下命令为设备分配友好名称:

🌐 Devices added via the website URL/QR code will default to displaying their UDID when selecting them for an EAS Build. You can assign friendly names to your devices with the following command:

Terminal
# Rename devices on Expo and the Apple Developer Portal
eas device:rename

分发机制概述

🌐 Overview of distribution mechanisms

以下是将你的应用分发到内部分发支持的设备的不同机制。

🌐 The following are the different mechanisms for distributing your app to devices supported by internal distribution.

Android:构建并分发 APK

要将你的应用分享至安卓设备,你必须构建项目的 APK(Android 应用包文件)。APK 可以直接通过 USB 安装到安卓设备上,或者通过网络下载文件,或通过电子邮件或聊天应用发送给用户,一旦用户接受了安装未通过 Play 商店审核的应用的安全警告即可安装。你的应用的 AAB(Android 应用包)二进制文件必须通过 Play 商店分发。

🌐 To share your app to Android devices, you must build an APK (Android application package file) of your project. APKs can be installed directly to an Android device over USB, by downloading the file over the web or through an email or chat app, once the user accepts the security warning for installing an app that has not gone through Play Store review. AAB (Android app bundle) binaries of your app must be distributed through the Play Store.

iOS:Ad Hoc 分发

苹果提供临时配置文件来将你的应用分发到已注册到你的 Apple 开发者账户的测试设备。此方法需要付费的 Apple 开发者账户,而且该账户每年最多只能使用此方法分发给 100 部 iPhone。

🌐 Apple offers ad hoc provisioning profiles to distribute your app to test devices once they have been registered to your Apple Developer account. This method requires a paid Apple Developer account and that account will only be able to use this method to distribute to at most 100 iPhones per year.

你需要知道每个将安装你的应用的设备的 UDID(唯一设备标识符),如果你尝试与非开发者分享,这可能会有些困难。添加新设备将需要重新构建你的应用或使用新证书重新签名该构建

🌐 You will need to know the UDID (Unique Device Identifier) of each device that will install your app, which may be challenging if you try to share with someone who is not a developer. Adding a new device will require a rebuild of your app or re-signing the build with new credentials.

如果你以前没有做过,正确设置 Ad Hoc 证书可能会让人望而生畏,即使你做过,也可能觉得繁琐。如果你使用的是 EAS Build,它针对 Expo 和 React Native 项目进行了优化,我们将为你处理设置 Ad Hoc 凭证时耗时的部分。

🌐 Setting up Ad Hoc certificates correctly can be intimidating if you haven't done it before and tedious even if you have. If you're using EAS Build, which is optimized for Expo and React Native projects, we'll handle the time-consuming parts of setting up Ad Hoc credentials for you.

iOS:企业分发

如果你的应用仅供大型组织的员工内部使用,并且无法通过 App Store 分发,则应使用企业分发。与临时分发不同,企业分发允许安装你应用的设备数量无限制,且无需管理每个设备的 UDID。通常,这些应用会通过移动设备管理(MDM)解决方案分发给终端用户。企业分发需要加入 Apple Developer Enterprise Program 会员。加入企业计划的组织必须满足超出 App Store 分发要求的额外条件。

🌐 If your app is only intended for internal use by employees of a large organization and cannot be distributed through the App Store, you should use Enterprise distribution. Unlike with Ad Hoc Distribution, the number of devices that can install your app is unlimited, and you do not need to manage each device's UDID. Often these apps will be distributed to end users through a mobile device management (MDM) solution. Enterprise Distribution requires membership in the Apple Developer Enterprise Program. Organizations joining the Enterprise Program must meet additional requirements beyond what is required for App Store distribution.