NativeScript / NativeScript/nativescript-cli

tns run/devices fails (w/ fix info)

Ouverte
#4,508 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

@rosen-vladimirov y travaille déjà.

Depuis le 15/4/2019.

needs more info
Langage dominant
JavaScript
Étoiles
1.1k
Forks
204
Merge moyen
1 j 9 h
PR mergées (30 j)
8

Description

Environment

  • CLI: 5.3.1

Describe the bug
After upgrading to the latest version of the Android Studio Emulator, Images, SDK; tns devices fails with the following error:

Connected devices & emulators
Searching for devices...
Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.

tns run android fails with:

Searching for devices...
Cannot find connected devices.
Emulator start failed with: No emulator image available for device identifier 'undefined'.
To list currently connected devices and verify that the specified identifier exists, run 'tns device'.
To list available emulator images, run 'tns device <Platform> --available-devices'.

Doing a tns devices --log full gives me this:

spawn: /home/.../Android/Sdk/platform-tools/adb "devices"
Error while checking for devices. TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at assertPath (path.js:39:11)
    at Object.join (path.js:1155:7)
    at AndroidVirtualDeviceService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/android/android-virtual-device-service.js:65:38)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/nativescript/lib/common/mobile/android/android-virtual-device-service.js:10:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.
(node:14038) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated

Key line being: android-virtual-device-service.js:65

tns doctor shows no issues.
adb devices -- does show the running emulators properly...

To Reproduce
Upgrade to the latest sdk, tools:
image

Expected behavior
It actually works. 😀

Additional context
Setting the
ANDROID_AVD_HOME & ANDROID_SDK_ROOT fixes the issue. From what I can gather ANDROID_HOME is now depreciated... So this might need to be an added error in TNS doctor; and a warning here instead of throwing an error that is unhelpful...


ANDROID_SDK_ROOT should be the same value as ANDROID_HOME
ANDROID_AVD_HOME on my Linux machine ends up being /home/<USER_NAME>/.android/avd/
On mac, it will probably be /Users/<USER_NAME>/.android/avd/

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.