Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Android runner can't start on a Windows host: SDK binaries are looked up without .exe or .bat

Đang mở Phù hợp với người mới
#201 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, nodejs, react-native, typescript
Lĩnh vực
mobile-dev

Hướng nghiên cứu

Bắt đầu từ packages/platform-android/src/environment.ts, nơi getAdbBinaryPath, getEmulatorBinaryPath, getSdkManagerBinaryPath và getAvdManagerBinaryPath tạo đường dẫn SDK mà không có phần mở rộng của Windows. Kiểm tra cách ensureAndroidAdbAvailable và ensureAndroidCommandLineTools sử dụng các đường dẫn này, và nơi các tệp .bat được khởi chạy, việc này cần shell: true trên win32. Hoàn thành khi việc tra cứu phân giải được adb.exe, emulator.exe, sdkmanager.bat và avdmanager.bat trên Windows, và trình chạy Android vượt qua bước kiểm tra SDK trên máy chủ Windows.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
  1. On Windows, with ANDROID_HOME set to an Android SDK that has platform-tools and cmdline-tools, build the playground for Android.
  2. Run react-native-harness --harnessRunner android in apps/playground.
  3. It exits before reaching the emulator.
Ngôn ngữ chính
TypeScript
Star
333
Fork
20
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của callstackincubator/react-native-harness

Tất cả issue của callstackincubator/react-native-harness

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.