expo-dev-client

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Use EAS Build to create development clients for testing native code changes on physical devices. Use this for creating custom Expo Go clients for testing branches of your app.
使用EAS Build创建开发客户端,以便在物理设备上测试原生代码变更。可用于创建自定义Expo Go客户端,以测试应用的分支版本。

Important: When Development Clients Are Needed

重要提示:何时需要开发客户端

Only create development clients when your app requires custom native code. Most apps work fine in Expo Go.
You need a dev client ONLY when using:
  • Local Expo modules (custom native code)
  • Apple targets (widgets, app clips, extensions)
  • Third-party native modules not in Expo Go
Try Expo Go first with
npx expo start
. If everything works, you don't need a dev client.
仅当你的应用需要自定义原生代码时,才创建开发客户端。 大多数应用在Expo Go中即可正常运行。
仅在以下场景中你才需要开发客户端:
  • 本地Expo模块(自定义原生代码)
  • Apple端目标(小组件、App Clip、扩展功能)
  • Expo Go未包含的第三方原生模块
请先尝试使用Expo Go,执行
npx expo start
。如果一切正常,则无需开发客户端。

EAS Configuration

EAS配置

Ensure
eas.json
has a development profile:
json
{
  "cli": {
    "version": ">= 16.0.1",
    "appVersionSource": "remote"
  },
  "build": {
    "production": {
      "autoIncrement": true
    },
    "development": {
      "autoIncrement": true,
      "developmentClient": true
    }
  },
  "submit": {
    "production": {},
    "development": {}
  }
}
Key settings:
  • developmentClient: true
    - Bundles expo-dev-client for development builds
  • autoIncrement: true
    - Automatically increments build numbers
  • appVersionSource: "remote"
    - Uses EAS as the source of truth for version numbers
确保
eas.json
文件中包含开发配置项:
json
{
  "cli": {
    "version": ">= 16.0.1",
    "appVersionSource": "remote"
  },
  "build": {
    "production": {
      "autoIncrement": true
    },
    "development": {
      "autoIncrement": true,
      "developmentClient": true
    }
  },
  "submit": {
    "production": {},
    "development": {}
  }
}
关键配置项:
  • developmentClient: true
    - 为开发构建打包expo-dev-client
  • autoIncrement: true
    - 自动递增构建版本号
  • appVersionSource: "remote"
    - 使用EAS作为版本号的可信来源

Building for TestFlight

为TestFlight构建

Build iOS dev client and submit to TestFlight in one command:
bash
eas build -p ios --profile development --submit
This will:
  1. Build the development client in the cloud
  2. Automatically submit to App Store Connect
  3. Send you an email when the build is ready in TestFlight
After receiving the TestFlight email:
  1. Download the build from TestFlight on your device
  2. Launch the app to see the expo-dev-client UI
  3. Connect to your local Metro bundler or scan a QR code
通过一条命令构建iOS开发客户端并提交至TestFlight:
bash
eas build -p ios --profile development --submit
该命令将:
  1. 在云端构建开发客户端
  2. 自动提交至App Store Connect
  3. 当构建在TestFlight中准备就绪时向你发送邮件
收到TestFlight邮件后:
  1. 在你的设备上从TestFlight下载构建包
  2. 启动应用,查看expo-dev-client界面
  3. 连接到本地Metro打包器或扫描二维码

Building Locally

本地构建

Build a development client on your machine:
bash
undefined
在你的设备上构建开发客户端:
bash
undefined

iOS (requires Xcode)

iOS(需要Xcode)

eas build -p ios --profile development --local
eas build -p ios --profile development --local

Android

Android

eas build -p android --profile development --local

Local builds output:
- iOS: `.ipa` file
- Android: `.apk` or `.aab` file
eas build -p android --profile development --local

本地构建输出:
- iOS:`.ipa`文件
- Android:`.apk`或`.aab`文件

Installing Local Builds

安装本地构建包

Install iOS build on simulator:
bash
undefined
在模拟器上安装iOS构建包:
bash
undefined

Find the .app in the .tar.gz output

在.tar.gz输出文件中找到.app文件

tar -xzf build-*.tar.gz xcrun simctl install booted ./path/to/App.app

Install iOS build on device (requires signing):

```bash
tar -xzf build-*.tar.gz xcrun simctl install booted ./path/to/App.app

在设备上安装iOS构建包(需要签名):

```bash

Use Xcode Devices window or ideviceinstaller

使用Xcode设备窗口或ideviceinstaller

ideviceinstaller -i build.ipa

Install Android build:

```bash
adb install build.apk
ideviceinstaller -i build.ipa

安装Android构建包:

```bash
adb install build.apk

Building for Specific Platform

为特定平台构建

bash
undefined
bash
undefined

iOS only

仅iOS

eas build -p ios --profile development
eas build -p ios --profile development

Android only

仅Android

eas build -p android --profile development
eas build -p android --profile development

Both platforms

两个平台

eas build --profile development
undefined
eas build --profile development
undefined

Checking Build Status

检查构建状态

bash
undefined
bash
undefined

List recent builds

列出最近的构建记录

eas build:list
eas build:list

View build details

查看构建详情

eas build:view
undefined
eas build:view
undefined

Using the Dev Client

使用开发客户端

Once installed, the dev client provides:
  • Development server connection - Enter your Metro bundler URL or scan QR
  • Build information - View native build details
  • Launcher UI - Switch between development servers
Connect to local development:
bash
undefined
安装完成后,开发客户端提供以下功能:
  • 开发服务器连接 - 输入Metro打包器URL或扫描二维码
  • 构建信息 - 查看原生构建详情
  • 启动器界面 - 在不同开发服务器间切换
连接到本地开发环境:
bash
undefined

Start Metro bundler

启动Metro打包器

npx expo start --dev-client
npx expo start --dev-client

Scan QR code with dev client or enter URL manually

使用开发客户端扫描二维码或手动输入URL

undefined
undefined

Troubleshooting

故障排除

Build fails with signing errors:
bash
eas credentials
Clear build cache:
bash
eas build -p ios --profile development --clear-cache
Check EAS CLI version:
bash
eas --version
eas update
构建因签名错误失败:
bash
eas credentials
清理构建缓存:
bash
eas build -p ios --profile development --clear-cache
检查EAS CLI版本:
bash
eas --version
eas update