Vanilla Installation Fails on Hello World (Feb '17)


#1

Thanks for your time and any help.

Using: https://docs.nativescript.org/start/quick-setup
Ending In: $ tns doctor
On: OSX Sierra 10.12.3
Yields:

The ANDROID_HOME environment variable is not set or it points to a non-existent directory…

WARNING: adb from the Android SDK is not installed or is not configured properly…

WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the native emulator…

WARNING: xcodeproj gem is not installed or is not configured properly.
You will not be able to build your projects for iOS…

WARNING: CocoaPods is not installed or is not configured properly…

You need to have the Android SDK Build-tools installed on your system…

You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system…

There seem to be issues with your configuration.
? Do you want to visit the official documentation?

I also noticed:

TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.

A lot of these seem like errors that are fixable, but shouldn’t the install script have done all this already?

A sidenote: I can’t run the basic hello world from tns run ios | tns run android - likely because of the above. This was a very poor first experience for me, but I hope once it gets sorted this tool will greatly simplify my development workflow. Thanks for the effort guys.


#2

If you open a terminal can you execute android? If you can that means you at least have android installed, which should open the android sdk manager. Then you can manually go in and install what you need to get developing android apps.

Setting the ANDROID_HOME variable - I forget exactly when/where you do that. I know what it is but I hate setup too so I have forgotten everything once I got my system set up :laughing:


#3

Couple things,

First and foremost thank you for the reply.

Second, I can run $ android to get to the library install page of the Android SDK (the Manager). However, several of these packages including CocoaPods and xcodeproj (the latter, obviously not related to Android, and most likely the culprit for why $ tns run ios fails as well) seem unrelated to this fix.

Third, should I just not trust the installer to do anything right? It seems it has mangled every package it’s tried to install. What’s the deal?


#4

Sorry I haven’t looked at or tried the installer. I did everything manually over a year ago :smile:which is why I don’t remember a lot of the process.

You’ll need cocoapods installed on your mac for iOS and the .xcodeproj is part of the native iOS app. When you do a tns build ios or tns run ios this file should be created in your app. If you’re getting an error related to the .xcodeproj file you should try deleting libs, platforms, hooks, node_modules then run tns build ios and then tns run ios. I like to do build then run to be more explicit and monitor the CLI as it works out a build. Doing tns run ios should be sufficient however.


#5

I have the same problem.

My system is Ubuntu 16.04, 32 bit.

I have followed the instructions in detail. I have tried both installing only the sdk and installing the whole android-studio. When I type echo $ANDROID_HOME in the terminal I get the directory that contains the tools and platform-tools directories. I can open android studio and it seems to work fine. And I have updated the files by the command

sudo $ANDROID_HOME/tools/android update sdk --filter tools,platform-tools,android-23,build-tools-23.0.3,extra-android-m2repository,extra-google-m2repository,extra-android-support --all --no-ui

as instructed on nativescript.org.

Still I get the same error message when trying to install nativescript witn npm as Paws5000 describes above:

“The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android. [etc etc.]”

I am at my wits end, and if I can’t work this out I simply cant use nativeScript. Can some kind person tell me what to do?


#6

Have you restarted the machine? A restart will sometimes kick in environment variables.


#7

Obviously. But after restart the ANDROID_HOME variable has to be set again, so that doesn’t really help.


#8

Ok, I am officially giving up on nativeScript. I have followed the installation instructions minutely, and they just don’t work. When asking for help in this thread I only received rude trolling. I am not wasting any more time on this. It sounded like a great idea, too bad it doesn’t work.


#9

Where on this thread did you find rude trolling? We’d like to help get you up and running, I know it can be frustrating getting started, but many people are finding success building apps with NativeScript.


#10

Suggesting a reboot for the environment variables to kick in isn’t trolling?


#11

no, it’s not. Brad is trying to help!


#12

If that was an attempt to be helpful he obviously has no clue what he is talking about and there is no reason he should even post in this thread. I am done wasting time on nativeScript.


#13

If ANDROID_HOME is being reset during a reboot, it means that it hasn’t been set in your profile. It is a solid test to see if the environment variables have been properly configured.

Running the following will only set the environment variable for the session:

$ export ANDROID_HOME=/path/to/android-sdk

That will not retain after the session ends. You need to set the variable in your user profile for Linux and Mac. ANDROID_HOME is not a NativeScript thing, it is an Android thing.

Hopefully that clears things up on why a restart was recommended.

Best,


#14

Maria,

I’ve been using Windows, Linux and Mac’s for over 20 years – Brad was not trolling; rebooting after an install on any of the platforms might fix issues like this where the environmental variables might not have had a chance to go into effect. On Linux re-logging in is normally the easier way; but a reboot won’t hurt anything, and is easier to tell people to do…

f you want people to help you you can’t insult or sully the reputation of people who actually TOOK the time to try and help you even though the advise may not have worked for you. Brad is one of the top contributors to the NativeScript community!


Your ANDROID_HOME variable really should be set in your profile and not manually; along with the JAVA_HOME.

On my Linux Box this is my setup:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export ANDROID_HOME=/usr/local/android-sdk-linux
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

These are dropped in my ~/.bashrc

So they take affect when I login.

My /usr/local/android-sdk-linux looks like this:

Please also note; that if you don’t have the correct versions of the Android platform tools it might have issues. V2.5 of NativeScript was recently released it might require a newer version of the platform tools and as such that might be the reason it is failing… On my Windows box I have almost every recent version of the tools installed do to the number of different android projects I do. Having these installed makes sure everything works no matter what you get. :slight_smile:

In addition you MUST have the Support Repo & Support Library installed;

Nathanael A.


#15

Hey guys,

I have the very same problem as Maria’s one. I did everything what @NathanaelA and @bradwaynemartin suggested. However, after running the following command
sudo npm install nativescript -g --unsafe-perm
I come up with the following message

The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.

WARNING: The Android SDK is not installed or is not configured properly.

Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.

My OS is Linux Lubuntu 16.10.
when I echo $ANDROID_HOME it returns the correct installation folder: /~/Android
The contents of the folder is
build-tools extras platforms platform-tools temp tools

Please advice. I already spent the most of the day on this installation without any luck.

Thank you in advance!
Ivan

P.S. I also tried by installing the Android Studio: same outcome. :frowning:


#16

I don’t think you should install with sudo @nathanaela will know more on
that.


#17

Hey @bradwaynemartin

I tried without sudo, but then I got permission denied error, since the installer needs access to /usr/lib/node_modules.

Actually I am following http://docs.nativescript.org/start/ns-setup-linux, point 8.1. which requires sudo too.

Thanks
Ivan


#18

There have been changes in the Android SDK that obsoleted and removed tools in the latest (March) update of the Android SDK Tools. I advise that you remove the current version and install 25.2.x instead. More info https://github.com/NativeScript/nativescript-cli/issues/2583#issuecomment-285697794


#19

Hey @Pete.K,

Thanks for you suggestion. I started fresh with the latest version (tools_r25.2.3-linux.zip) from the very beginning. I didn’t have anything Android/Java related on my Lubuntu when I started to setup NativeScript.

Thanks
Ivan


#20

Can you verify that echo $ANDROID_HOME outputs the correct path to your SDK installation? Could you also share a screenshot of the UI sdk manager when you run android?

Thanks!