Nativescript-cli: Error when run tns run android command

Created on 18 Apr 2017  路  5Comments  路  Source: NativeScript/nativescript-cli

After install Android Studio, Android SDK, and all required things to build Android apps with NativeScript I get this error when I run the next command:

tns run android

OS:

Mac OS Sierra

Which platform(s) does your issue occur on?

Android

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

  • CLI: 2.5.4

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

I have installed the Android Studio full application, not only the SDK one. If I run the tns run ioscommand, with all preinstalled things, It works correctly, but when I run tns run android it fails with the next error:

tns run android
Skipping prepare.
Searching for devices...
Could not find an emulator image to run your project.
# run android

I also tried to install Android SDK with the next command:

brew cask install android-sdk

without success.

question

All 5 comments

Hi @frankfullstack

Most likely you have Android Studio installed, but you have no emulator images available.
Can you please run $ANDROID_HOME/tools/bin/avdmanager list avds and paste the output here?

Thanks @dtopuzov I run that command and get the installed Devices (via Android Studio tools):

$ANDROID_HOME/tools/bin/avdmanager list avd
Available Android Virtual Devices:
Name: 4.65_720p_Galaxy_Nexus_API_25
Device: 4.65in 720p (Galaxy Nexus) (Generic)
Path: /Users/frankfullstack/.android/avd/4.65_720p_Galaxy_Nexus_API_25.avd
Target: Google APIs (Google Inc.)
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
Skin: 720x1280
Sdcard: 100M
---------
Name: Nexus_One_API_25
Device: Nexus One (Google)
Path: /Users/frankfullstack/.android/avd/Nexus_One_API_25.avd
Target: Google APIs (Google Inc.)
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
Skin: nexus_one
Sdcard: 100M

But when I run the tns run android I get the previous error.

Can you also run tns run android --log trace and paste last lines (let's say last 100 lines) here.

As temporary workaround I can suggest you following:

  1. Manually start Android emulator
  2. tns run android will reuse running instance and it will not search for avd images.

Thanks @dtopuzov, I removed and added the android platform to the project and it solves that.

The tns run android is running normally.

I'm glad to here everything is fine.
Closing the issue.

Was this page helpful?
0 / 5 - 0 ratings