Android: running emulator classified as hardware when adb device name is not generic*, so --virtual fails with ERR_NO_TARGET

Aperta Adatta ai principianti
#409 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
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, typescript
Ambito
mobile-dev

Direzione di ricerca

Inizia in dist/android/utils/adb.js in corrispondenza di parseAdbDevices, dove l’issue indica il controllo del nome device: che classifica i dispositivi ADB. Verifica il comportamento con le proprietà segnalate di emulator-5554 e controlla i test Android per l’elenco dei dispositivi. Il lavoro è completato quando un emulator-<port> connesso è elencato come virtuale anche se il suo nome dispositivo è emu64xa16k, e può essere selezionato con --virtual.

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

Descrizione

Version: native-run 2.0.3 (latest on npm)

Platform: Linux x86_64, Android Emulator 37.1.11, AVD from the Pixel 10 profile with a 16 KB page-size system image (sdk_gphone16k_x86_64, API 37)

Description

A running emulator is classified as hardware, so --virtual cannot select it and run fails with ERR_NO_TARGET, even though adb lists the emulator as connected.

adb devices -l reports:

emulator-5554  device product:sdk_gphone16k_x86_64 model:sdk_gphone16k_x86_64 device:emu64xa16k transport_id:1

dist/android/utils/adb.js (parseAdbDevices) only treats a serial as an emulator when its device: property starts with generic:

const isGenericDevice = (properties['device'] || '').startsWith('generic');
const type = 'usb' in properties || isIP || !serial.startsWith('emulator') || !isGenericDevice ? 'hardware' : 'emulator';

Current emulator system images report device:emu64xa16k (and similar emu64* values), not generic*. The emulator therefore becomes type: 'hardware'.

Steps to reproduce

  1. Start an AVD whose system image reports a non-generic device name, e.g. a recent Google APIs / 16 KB page-size image.
  2. native-run android --list --json lists it under devices, and virtualDevices stays empty.
  3. native-run android --app app-debug.apk --virtual fails:
ERR_NO_TARGET: No target devices/emulators available.

The same command without --virtual installs on the emulator, because it is picked as a hardware device.

ionic cordova run android --emulator maps to --virtual, so Ionic Cordova live reload on an emulator is affected.

Expected

A serial of the form emulator-<port> that adb reports in the device state is a running emulator, whatever its device: property says. --virtual should select it.

Possible fix

Classify emulator-<port> serials as emulators without depending on the device: name, or additionally accept the emu* prefix. Alternatively, check ro.kernel.qemu / ro.boot.qemu from getprop, which getDevices already reads.

Related

#324: AVD home resolution ignores $ANDROID_USER_HOME/XDG locations. In the same setup that compounds this bug, because the fallback that would boot an AVD finds none.

Lingua principale
TypeScript
Stelle
139
Fork
35
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 ionic-team/native-run

Tutte le issue di ionic-team/native-run

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.