Can't run on Android device from macOS


#1

Hey community!

I’m struggling trying to run the HelloWorld template from the Chapter 1—Learning the NativeScript Basics

I’ve posted the error log at the issues tracker on Github.

Any help to get this thing running, or any comment for that matter, is highly appreciated.

Thanks in advance.


#2

What are you getting when you run tns devices
when your device is connected to Mac


#3

$ tns devices

Connected devices & emulators
Searching for devices…
│ # │ Device Name Platform │ Device Identifier │ Type │ Status │
│ 1 │ B1-770_WW_GEN1 │ Android │ 813543652035 │ Device │ Connected │


#4

how about when you try to run on iOS simulator do you face the same issue?
also what do you get when you run tns doctor


#5

The output to tns doctor is in this other post with some others issues I had when installing nativescript. The HelloWord app runs on iOS simulator just fine.


#6

This is a gist with the most recent output.


#7

Here are the things:
It seems you installed your node manually and there are problems with permissions.

My suggestion is following

-uninstall nativescript

npm install -g nativescript

  • install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew update

  • then install node8 LTS using brew (last week announced it support node 9 but I would stick with 8 for now)
    brew unlink node
    brew install node@8
    brew link node@8

then install nativescript

npm install -g nativescript

then do tns doctor and share logs


#8

Unfortunately I’m getting the same error, one thing I haven’t tried yet is installing Java 8 and Android SDK via homebrew.


#9

share your new tns doctor

and now what do you get when you do
node -v


#10

homebrew was complaining about Xcode being outdated, just in case I removed the Xcode.app and now I have to wait for it to download from the AppStore. I’ll try agin with node@8 and node@6 and post the results here when Xcode is ready. Currently I have the latest node from homebrew

$ node -v
v9.3.0
$ npm -v
5.6.0

#11

@ganas this is the most recent output of tns doctor after I was able to install the latest Xcode stable release. The issue with Android persists though, also tried running on iOS with the new iOS simulator, for iOS the HellowWorld app runs ok. The test was done using node@8

$ node -v
v8.9.3

#12

share the output of

ls $ANDROID_HOME
ls $ANDROID_HOME/platforms

I wanna make sure you sdk path set correctly.
do you have android studio installed ?


#13

Yes I have Android Studio 3.0.1

23 PM

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

$ echo $ANDROID_HOME
/Users/user/Library/Android/sdk

$ echo $ANDROID_SDK_HOME
/Users/user/Library/Android/sdk

$ echo $ANDROID_NDK_ROOT
/Users/user/Library/Android/sdk/ndk-bundle

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/user/Library/Android/sdk/platform-tools:/Users/user/go/bin

$ ls $ANDROID_HOME
add-ons		cmake		extras		licenses	metrics		patcher		platforms	sources		tools
build-tools	emulator	fonts		lldb		ndk-bundle	platform-tools	skins		system-images

$ ls $ANDROID_HOME/platforms
android-10	android-16	android-17	android-19	android-21	android-22	android-23	android-25	android-26

#14

when you switch to node 8, did you uninstall nativescript and install it again? also do you face the same issue running ios


#15

The app copied to device finally and now it runs fine, at last. I even tried deleting the folder sdk in ~/Library/Android/ (it was occupying too much space anyway) and installing the sdk via homebrew, although it didn’t work either, nor updating the modules in the HelloWorld app with tns update.

What did the trick was removing the android platform and adding android@next like so:

$ tns platform remove android
$ tns platform add android@next

@ganas thank you so much for looking into the problem, I appreciate it a lot.