Android runner can't start on a Windows host: SDK binaries are looked up without .exe or .bat
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- android, nodejs, react-native, typescript
- 领域
- mobile-dev
调研方向
从 packages/platform-android/src/environment.ts 开始,这里的 getAdbBinaryPath、getEmulatorBinaryPath、getSdkManagerBinaryPath 和 getAvdManagerBinaryPath 在构建 SDK 路径时没有加上 Windows 扩展名。检查 ensureAndroidAdbAvailable 和 ensureAndroidCommandLineTools 如何使用这些路径,以及在哪里启动 .bat 文件,在 win32 上这需要 shell: true。完成的标准是:在 Windows 上查找能解析出 adb.exe、emulator.exe、sdkmanager.bat 和 avdmanager.bat,并且 Android 运行器在 Windows 主机上通过 SDK 检查。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
On Windows, every Android runner — emulator or physical device — fails before it reaches a device, with:
Error: Android command-line tools are missing. Set ANDROID_HOME or ANDROID_SDK_ROOT to an initialized SDK.
at ensureAndroidCommandLineTools (packages/platform-android/dist/environment.js:114:15)
at async ensureAndroidSdkPackages (packages/platform-android/dist/environment.js:252:5)
at async Module.getAndroidRunner (packages/platform-android/dist/runner.js:7:5)
at async Object.work (packages/jest/dist/harness-session.js:411:32)
at async withPlatformReadyTimeout (packages/jest/dist/harness-session.js:99:16)
at async Promise.all (index 1)
although ANDROID_HOME points at an SDK with platform-tools and cmdline-tools installed. (What a user actually sees is an AbortError crash; the message above shows once that is fixed: #200.)
packages/platform-android/src/environment.ts builds the SDK paths without Windows extensions: getAdbBinaryPath gives platform-tools/adb, getEmulatorBinaryPath emulator/emulator, and getSdkManagerBinaryPath / getAvdManagerBinaryPath cmdline-tools/latest/bin/sdkmanager / avdmanager, where Windows has adb.exe, emulator.exe, sdkmanager.bat and avdmanager.bat. So ensureAndroidAdbAvailable decides platform-tools is missing, the bootstrap then finds no sdkmanager, and throws. With adb.exe alone, a runner on an already running emulator works — I ran #197's reproduction that way. Appending the extension on win32 fixes the lookups; spawning a .bat also needs shell: true there, since Node's fix for CVE-2024-27980.
System Info
System:
OS: Windows 11 10.0.26200
Binaries:
Node: 26.5.0
SDKs:
Android SDK:
API Levels: 35, 36, 37
Build Tools: 35.0.0, 36.0.0, 36.1.0, 37.0.0
react-native: 0.82.1 (apps/playground)
React Native Harness Version
1.5.0 (main at 58850ce)
Reproduction
https://github.com/callstackincubator/react-native-harness/tree/main/apps/playground
Steps to reproduce
- On Windows, with
ANDROID_HOMEset to an Android SDK that has platform-tools and cmdline-tools, build the playground for Android. - Run
react-native-harness --harnessRunner androidinapps/playground. - It exits before reaching the emulator.
- 主要语言
- TypeScript
- 星标
- 333
- 派生
- 20
- 平均合并
- 14 小时 55 分钟
- 30 天内合并 PR
- 44
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstackincubator/react-native-harness 的其他 Issue
-
--metroPort is documented, but the CLI rejects it as an unrecognized option可能已有人在做 @YevheniiKotyrlo 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
callstackincubator/react-native-harness#199 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
callstackincubator/react-native-harness#128 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
callstackincubator/react-native-harness#277 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
callstackincubator/react-native-harness#273 ·
维护者通常 1 天内回复
-
Android Activity recreation during a UI test is not reported as a host lifecycle change可能已有人在做 @mrousavy 于 2 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
callstackincubator/react-native-harness#271 · 1 条评论 ·
维护者通常 1 天内回复
查看 callstackincubator/react-native-harness 的全部 Issue
相似的 Issue
-
bug hacktoberfest help wanted
难度 2/5 1-3 小时 新手友好度 82/100
libredb/libredb-studio#1941 ·
维护者通常 1 天内回复
-
chore other
难度 2/5 1-3 小时 新手友好度 78/100
alastair-smith/card-games#308 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
paperclipai/paperclip#17379 ·
维护者通常 1 天内回复
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Anime Quote 626 (good-first-issue)未关闭community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 76/100
lingdojo/kana-dojo#33040 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
bug mobile ui
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复