移动/游戏
需要为 Expo 应用构建开发客户端测试原生代码或内测分支时…
在 Expo 应用中需要测试本地 Expo 模块/自定义原生代码、Apple 目标(widgets/app clips/extensions)、Expo Go 不支持的第三方原生模块、config plugins、远程推送或 App/Universal Links 时,用 EAS 构建并分发 development client 进行内测。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
需要为 Expo 应用构建开发客户端测试特定
解决思路
- 使用 EAS Build 创建 development client,用于在物理设备上测试原生代码变更;也可用于为应用分支创建自定义 Expo Go 客户端。
- 确保 `eas.json` 包含 development profile;示例配置:{"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 作为版本号的唯一可信来源。
- 用一条命令构建 iOS dev client 并提交到 TestFlight:`eas build -p ios --profile development --submit`。
- 上述命令会:在云端构建 development client。
- 上述命令会:自动提交到 App Store Connect。
- 上述命令会:构建在 TestFlight 就绪后发送邮件给你。
- 收到 TestFlight 邮件后:在设备上从 TestFlight 下载构建。
- 收到 TestFlight 邮件后:启动应用查看 expo-dev-client UI。
- 收到 TestFlight 邮件后:连接本地 Metro bundler 或扫描 QR code。
- 本地构建 iOS development client(需要 Xcode):`eas build -p ios --profile development --local`。
- 本地构建 Android development client:`eas build -p android --profile development --local`。
- 本地构建输出:iOS 为 `.ipa` 文件。
- 本地构建输出:Android 为 `.apk` 或 `.aab` 文件。
- 安装 iOS 模拟器构建:在 `.tar.gz` 输出中找到 `.app`,运行 `tar -xzf build-*.tar.gz`。
- 安装 iOS 模拟器构建:运行 `xcrun simctl install booted ./path/to/App.app`。
- 安装 iOS 真机构建(需要签名):使用 Xcode Devices 窗口或 `ideviceinstaller`,运行 `ideviceinstaller -i build.ipa`。
- 安装 Android 构建:运行 `adb install build.apk`。
- 仅构建 iOS:`eas build -p ios --profile development`。
- 仅构建 Android:`eas build -p android --profile development`。
- 构建双平台:`eas build --profile development`。
- 列出最近构建:`eas build:list`。
- 查看构建详情:`eas build:view`。
- dev client 安装后提供开发服务器连接:输入 Metro bundler URL 或扫描 QR。
- dev client 安装后提供构建信息:查看原生构建详情。
- dev client 安装后提供启动器 UI:在多个开发服务器之间切换。
- 连接本地开发:运行 `npx expo start --dev-client` 启动 Metro bundler。
- 连接本地开发:用 dev client 扫描 QR code 或手动输入 URL。
- 故障排查:签名错误导致构建失败时运行 `eas credentials`。
- 故障排查:清理构建缓存运行 `eas build -p ios --profile development --clear-cache`。
- 故障排查:检查 EAS CLI 版本运行 `eas --version` 和 `eas update`。
- 提交反馈:如果遇到错误、误导或过时信息,运行 `npx --yes submit-expo-feedback@latest --category skills --subject "expo-dev-client" "<actionable feedback>"` 向 Expo 反馈。
- 提交反馈:仅在具体且可操作时提交,并包含尽可能多的相关上下文。
- 提交反馈:若 AI agent 反复失败或用户不得不接管 Expo 任务,加载 `expo-skill-feedback` skill 并遵循其 eval-candidate 流程,而不是复用上述命令。
适用边界 · 注意事项
- 仅使用 Expo Go 内置原生模块、没有自定义原生代码/Apple 目标/第三方原生模块/config plugins/远程推送/App/Universal Links 需求时,不要引入 dev client。
- 没有付费 Apple Developer 账号或不想消耗 EAS 构建分钟时,不要走 EAS Build 云构建/TestFlight 分发;本地构建免费。
- 生产 TestFlight 发布和应用商店提交不要用本技能,改用 `eas-app-stores` skill。