Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#201 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, nodejs, react-native, typescript
Ambito
mobile-dev

Direzione di ricerca

Inizia da packages/platform-android/src/environment.ts, dove getAdbBinaryPath, getEmulatorBinaryPath, getSdkManagerBinaryPath e getAvdManagerBinaryPath costruiscono i percorsi dell'SDK senza le estensioni di Windows. Verifica come questi percorsi vengono usati da ensureAndroidAdbAvailable e ensureAndroidCommandLineTools, e dove vengono avviati i file .bat, il che richiede shell: true su win32. È completato quando le ricerche risolvono adb.exe, emulator.exe, sdkmanager.bat e avdmanager.bat su Windows e il runner Android supera il controllo dell'SDK su un host Windows.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
TypeScript
Stelle
333
Fork
20
Merge medio
1g 19h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstackincubator/react-native-harness

Tutte le issue di callstackincubator/react-native-harness

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.