创建并运行 Android 云构建
了解如何使用 EAS Build 配置 Android 设备和模拟器的开发版本。
在本章中,我们将使用 EAS Build 创建一个可以在 Android 上运行的开发版本。
¥In this chapter, we'll create a development build that can run on Android with EAS Build.
在 Android 设备或模拟器上创建和运行构建的过程是相同的,只是开发构建的安装有所不同。
¥The process for creating and running a build on Android devices or emulators is identical, with differences only in the installation of the development build.

为开发配置文件创建构建
¥Create a build for the development profile
对于 Android,开发版本必须位于 .apk 中。虽然默认的 Android 格式是 .aab,非常适合 Google Play 商店分发,但它无法安装在设备或模拟器上。
¥For Android, the development build must be in the .apk. While the default Android format is .aab, which is ideal for Google Play Store distribution, it cannot be installed on devices or emulators.
要创建 .apk:
¥To create a .apk:
-
在 eas.json 中,确保
build.development
配置文件下的developmentClient
设置为true
。¥In eas.json, make sure that
developmentClient
is set totrue
underbuild.development
profile. -
然后,运行
eas build
命令,其中android
作为平台,development
作为构建配置文件:¥Then, run the
eas build
command withandroid
as the platform anddevelopment
as the build profile:
-
eas build --platform android --profile development
提示:下次运行eas build
命令时,还可以使用-p
来指定平台。它是--platform
的缩写。
该命令提示我们以下问题:
¥This command prompts us with the following questions:
-
你希望你的 Android 应用 ID 是什么?按 return 选择为此提示提供的默认值。这将在 app.json 中添加
android.package
。¥What would you like your Android application id to be? Press return to select the default value provided for this prompt. This will add
android.package
in app.json. -
生成新的 Android 密钥库?按 Y。
¥Generate a new Android Keystore? Press Y.
响应后,构建将排队,我们可以通过 Expo 仪表板中 EAS CLI 提供的链接跟踪其进度:
¥After responding, the build will queue up, and we can track its progress via a provided link by the EAS CLI in the Expo dashboard:
What information does a build details page contain?
The build details page displays the build type, profile, Expo SDK version, app version, version code, last commit hash, and the identity of the developer or account owner who initiated the build.
In the above image, the current status of the Build artifact shows that the build is in progress. Upon completion, this section will offer an option to download the build. The Logs outlines every step taken during the Android build process on EAS Build. For the sake of brevity, we won't explore each step in detail here. To learn more, see Android build process.
What is an Android application ID?
Also known as the package name of our Android app, it stores the value in DNS reverse notation format (com.owner.appname
). Each component of this notation should start with a lowercase letter.
For example, our example app has com.owner.stickersmash
where com.owner
is the domain and stickersmash
is our app name.
Android device
1
Install development build
Once the build finishes, the Build artifact section gets updated, indicating that the build is complete:
This section provides the methods available for running the development build on an Android device: Expo Orbit and Install button.
Expo Orbit allows for seamless installation of the development build on an Android device. To use this method:
- Connect our Android device to our local machine using USB.
- Open the Orbit menu bar app.
- Select the Device in the Orbit app.
- On the Expo dashboard, under Build artifact, click the Open with Orbit.
After the build is installed, the Orbit app launches the development build on the device.
2
Android Emulator
1
Install the development build
In the terminal, once the build finishes, EAS CLI prompts us by asking whether we want to run the build on an Android Emulator. Press Y.
Alternate: Use Expo Orbit
Alternatively, Expo Orbit can be used for installation. From Build artifact on the Expo dashboard, click Open with Expo Orbit to install the development build on the Android Emulator.
2
Summary
Chapter 2: Create and run a cloud build for Android
We successfully used EAS Build to create and run development builds on Android devices and emulators, and learned about .apk and .aab file formats.
In the next chapter, learn how to configure a development build for iOS Simulators using EAS Build and get it running.