内部分发

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


将应用上传到 TestFlight 和 Google Play beta 可能非常耗时(例如,在可供测试人员使用之前等待构建运行通过静态分析)并且受到限制(例如,TestFlight 一次只能有一个活动构建) 。Android 和 iOS 都提供了替代机制来将应用直接分发给测试人员,因此他们可以在构建完成后立即从 Web 浏览器直接下载应用并将其安装到物理设备上。

¥Uploading your app to TestFlight and Google Play beta can be time-consuming (for example, waiting for the build to run through static analysis before becoming available to testers) and limiting (for example, TestFlight can only have one active build at a time). Both Android and iOS provide alternative mechanisms to distribute apps directly to testers, so they can download and install them to physical devices directly from a web browser as soon as the builds are completed.

EAS Build 可以通过为你的构建提供可共享的 URL 以及如何运行它们的说明来帮助你实现这一点,这样你就可以与队友共享一个 URL,其中包含他们测试应用所需的所有信息。

¥EAS Build can help you with this by providing shareable URLs for your builds with instructions on how to get them running, so you can share a single URL with a teammate that'll include all the information they need to test the app.

在 iOS 上安装应用比在 Android 上安装应用要困难一些,但这要归功于临时和企业配置文件。我们将在本文档后面详细讨论这一点。

¥Installing an app on iOS is a bit trickier than on Android, but it's possible thanks to ad hoc and enterprise provisioning profiles. We'll talk more about this later in this doc.

分发机制概述

¥Overview of distribution mechanisms

Android 和 iOS 都提供了在设备上直接安装应用版本的方法。这让你可以完全控制将特定构建放到设备上,允许你快速迭代并同时提供多个应用构建以供审核。

¥Both Android and iOS offer ways to install a build of your app directly on a device. This gives you full control of putting specific builds on devices, allowing you to iterate quickly and have multiple builds of your app available for review at the same time.

内部分发

¥Internal distribution

本节概述了两个平台上的内部分发机制。

¥This section provides an overview of mechanisms for internal distribution on both platforms.

Android: Build and distribute an APK

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

¥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 distribution

Apple 提供 临时配置文件,以便在测试设备注册到你的 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.

如果你以前没有正确设置过 Ad Hoc 证书,那么设置起来可能会很困难,即使设置过,也会很繁琐。如果你使用的是针对 Expo 和 React Native 项目进行了优化的 EAS 构建,我们将为你处理设置 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: Enterprise distribution

如果你的应用仅供大型组织的员工内部使用,并且无法通过 App Store 分发,则应使用企业分发。与 Ad Hoc Distribution 不同,可以安装你的应用的设备数量是无限的,你不需要管理每个设备的 UDID。通常,这些应用将通过移动设备管理 (MDM) 解决方案分发给终端用户。企业分发需要 Apple 开发者企业计划 成员资格。加入企业计划的组织必须满足 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.

Google Play/App Store 测试版本

¥Google Play/App Store testing releases

Android: Google Play beta

在完整公开发布之前,Google Play beta 是将你的应用分发给测试人员的另一种选择。你可以设置内部、封闭或开放的测试轨道,并控制谁有权访问该应用。

¥Before a complete public release, Google Play beta is another option to distribute your app to testers. You can set up either an internal, closed, or open test track and control who has access to the app.

每个测试轨道都有自己的要求。对于内部轨道,你最多只能邀请 100 名测试人员。封闭和开放轨道都支持更大的测试人员组。在封闭轨道中,你需要邀请测试人员,而在开放轨道中,任何人都可以加入你的计划。

¥Each test track has its own requirements. For the internal track, you can only invite up to 100 testers. Both closed and open tracks support larger groups of testers. In closed tracks, you need to invite testers, while in open tracks, anyone can join your program.

要使用 Google Play 测试版,你需要将你的应用作为 AAB(Android App Bundle)上传到 Google Play 控制台,设置测试轨道,并通过电子邮件或可共享链接邀请用户。测试人员可以通过 Play Store 安装应用,你可以直接从 Google Play 控制台收集反馈和崩溃报告。

¥To use Google Play beta, you need to upload your app as an AAB (Android App Bundle) to the Google Play Console, set up a test track, and invite users via email or a shareable link. Testers can install the app through the Play Store, and you can collect feedback and crash reports directly from the Google Play Console.

iOS: TestFlight

TestFlight 是将你的应用分发到 iOS 设备的另一种选择。TestFlight 还需要付费的 Apple 开发者账户。TestFlight 的内部测试选项允许你创建包含最多 100 名 Apple 开发者账户团队成员的测试组,然后他们通过 TestFlight 应用下载该应用。一些团队更喜欢 TestFlight,因为它不需要新版本来添加新的测试人员,并且应用会自动保持更新。

¥TestFlight is another option to distribute your app to iOS devices. TestFlight also requires a paid Apple Developer account. TestFlight's internal testing option allows you to create test groups that include up to 100 members of your Apple Developer account team, who then download the app through the TestFlight app. Some teams prefer TestFlight because it doesn't require a new build to add new testers, and apps stay updated automatically.

TestFlight 还包括一个外部测试选项,允许你通过电子邮件或公共链接与最多 10,000 名用户共享你的应用。

¥TestFlight also includes an external testing option that allows you to share your app with up to 10,000 users via an email or a public link.

TestFlight 中的内部和外部测试分发都要求你将 上传你的应用 连接到 App Store Connect 并等待自动审核,然后才能共享版本。但是,外部测试版本在分发之前需要经过更正式的 App Store 审核(这与你的应用在生产发布之前必须经过的审核不同)。

¥Both internal and external test distribution in TestFlight require you to upload your app to App Store Connect and wait for the automated review before you can share a build. However, external test builds will need to go through a more formal App Store review (which is distinct from the review that your app must undergo before production release) before being distributed.

使用 EAS Build 进行内部分发

¥Internal distribution with EAS Build

使用 EAS Build 设置内部分发构建只需几分钟,并提供了一种与你的团队和测试人员共享应用以获得反馈的简化方法。

¥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 testers for feedback.

设置需要将 "distribution": "internal" 设置为 eas.json 文件中所需的构建配置文件。此配置自动生成 Android 的 .apk 文件和 iOS 的 .ipa 文件,以便它们可以直接安装在设备上,而不需要开发服务器来运行应用。

¥The setup requires setting "distribution": "internal" to the desired build profile in your eas.json file. This configuration automatically generates .apk files for Android and .ipa files for iOS so that they can be installed on devices directly and do not require a development server to run the app.

对于 Android,EAS Build 将生成一个新的 Android 密钥库来签署 APK,或者如果包名称与你的 开发构建 相同,它将使用现有的密钥库。对于 iOS,EAS Build 将生成一个临时配置文件,该配置文件明确允许设备根据该设备的 UDID 运行该应用。这可以在创建新版本时使用 eas device:create 完成。

¥For Android, EAS Build will generate a new Android keystore for signing the APK, or it will use an existing one if the package name is the same as your development build. For iOS, EAS Build will generate an ad hoc provisioning profile that explicitly allows devices to run that app based on that device's UDID. This can be done using eas device:create when creating a new build.

有关如何配置、创建和安装构建的更多信息,请参阅下面有关使用 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)

可以使用 --non-interactive 标志在 CI 中以非交互方式运行内部分发版本。但是,如果你在 iOS 上使用临时配置,则使用此标志时将无法将新设备添加到你的配置文件中。通过 eas device:create 注册设备后,你需要以交互方式运行 eas build 并通过 Apple 进行身份验证,以便 EAS 将设备添加到你的配置文件中。了解有关从 CI 触发构建的更多信息

¥It's possible to run internal distribution builds non-interactively in CI using the --non-interactive flag. However, if you are using ad hoc provisioning on iOS you will not be able to add new devices to your provisioning profile when using this flag. After registering a device through eas device:create, you need to run eas build interactively and authenticate with Apple in order for EAS to add the device to your provisioning profile. Learn more about triggering builds from CI.

管理设备

¥Managing devices

你可以通过运行以下命令查看通过 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

此命令还会提示你在 Apple 开发者门户上禁用该设备。对于每个应用的临时分发,已禁用的设备仍计入 Apple 的设备数量限制为 100 台

¥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/QR 代码添加的设备在选择 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