Problems running "tns run android"

android

#1

I cannot seem to figure out why I don’t have any connected devices found when running “tns run android”. I also ran “tns doctor” and have no issues found. Here is an output of the error. Thanks!


#2

Does “tns device” or “tns device android --available-devices” list anything?

Did you setup any Adnroid emulator from AVD manager?


#3

Thanks for your response. When I run those commands there are no devices. I set up the Android emulator by using ruby -e “$(curl -fsSL https://www.nativescript.org/setup/mac)”. How do I do it from AVD manager?


#4

Try setting it up from AVD manager in Android Studio.


#5

Thanks for the help. At first I was not getting the same options until the tools tab in Android Studio but I found this link to fix that problem: https://stackoverflow.com/questions/46948322/how-to-open-avd-manager-in-android-studio-3-0-version

I then followed the steps in the link you provided and was successful in creating a virtual device which worked, but I ran into another issue. When I run “tns run android”, the device starts to run but I get an error. Thanks again for your help!


#6

Great, did you try the suggestion of increasing the RAM of emulator in the error message?

Also did you start the emulator before running the tns run android?


#7

I increased the RAM to 4096 and also tried changing the timeout to 300 but am still getting the same error. When you say start the emulator do you mean having Android Studio open? I am very new to this. I did come across the event log in Android Studio and I have an error. Thanks!


#8

You need to set the ANDROID_SDK_ROOT to $ANDROID_HOME/sdk.


#9

Thanks. I set the ANDROID_SDK_ROOT to that, but am still getting the same error. When I run “tns device”, I see there are still no connected devices. Do you actually have to connect a physical device to the computer to test it, or is it virtual? If so how can I connect the device? Thanks so much.


#10

Emulator should be fine, you don’t need to connect a physical device. Did you start the emulator after setting the ANDROID_SDK_ROOT?


#11

Yes I restarted Android Studio and the terminal. When I open Android Studio, I am getting the error message below and the error from before in the terminal. There are no errors in the event log after setting the ANDROID_SDK_ROOT.