Solvednativescript cli 'tns devices' does not find emulators

Did you verify this is a real problem by searching

Couldn't find a solution by searching.

Tell us about the problem

I have followed the installation guide in nativescript.org. I have installed android sdk. Then, installed android studio to create AVD as shown in the guide. AVD is working fine but tns devices command cannot find emulators even though it finds connected android device.

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.1.3
  • Cross-platform modules: Didn't create a project yet
  • Runtime(s): Didn't create a project yet
  • Plugin(s): Didn't create a project yet

Please tell us how to recreate the issue in as much detail as possible.

Create an avd in android studio as shown in the nativescript guide for AVDs. Then run tns devices

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

No code.

20 Answers

✔️Accepted Answer

I'm still getting the following error regardless of how I set ANDROID_HOME (with both the Homebrew installation and Android Studio installation).

I've tried both /usr/local/share/android-sdk (for Homebrew) and /Users/$user/Library/Android/sdk (for Android Studio)

Also I have an emulator installed but NativeScript still does not find it when I run tns run android --bundle

The error I get is the following:

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'.

When I run tns device android --available-devices, a device shows up but it still says the following:

tns device android --available-devices

Available emulators
┌───────────────┬──────────┬───────────┬───────────────────┬──────────────────┬────────────┐
│ Device NamePlatformVersionDevice IdentifierImage IdentifierError Help │
│ Pixel 3 API QAndroid  │           │                   │ Pixel_3_API_Q    │            │
└───────────────┴──────────┴───────────┴───────────────────┴──────────────────┴────────────┘

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.

Other Answers:

Hi @erkanarslan,

tns device or tns devices gives you a list of all connected/started devices in the moment of executing the command. If you need to check available emulator images you can execute tns devices android --available-devices or tns devices ios --available-devices.

I had a similar issue (tns run android was not working). The NativeScript Advanced Installation instructions say to set ANDROID_HOME to /usr/local/share/android-sdk. But when I changed it to /Users//Library/Android/sdk it started working. It was a fresh install of NativeScript on a macbook pro High Sierra 10.13.4.

More Issues: