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

オープン 初心者向け
#409 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
android, typescript
領域
mobile-dev

調査の方向性

dist/android/utils/adb.jsのparseAdbDevicesから始めます。ここでは、IssueがADBデバイスを分類するdevice:名のチェックを指摘しています。報告されたemulator-5554のプロパティで動作を確認し、Androidのデバイス一覧表示テストを確認してください。接続されたemulator-<port>が、デバイス名がemu64xa16kでも仮想デバイスとして一覧表示され、--virtualで選択できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
139
フォーク
35
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/native-run のほかの issue

ionic-team/native-run の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。