Damian Hetman
Damian Hetman

Reputation: 382

ANDROID_HOME location not found by NativeScript

I have problem with ANDROID_HOME on a Mac OS. I'm trying to add platform android to NativeScript app and I have this 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.

I've checked if I had SDK and yes, I have. Android Studio shows me this:

/Users/myuser/Library/Android/sdk

I found that I also have android sdk in /usr/local/Cellar/android

Before I have Xamarin and Homebrew which I think installs Android SKD itself. Maybe that is the problem?

Upvotes: 0

Views: 1934

Answers (5)

Rimski
Rimski

Reputation: 23

I had same problem when trying to set up Svelte-native and NativeScript. Problem was that Enviromental variables were set as administrator.

To set variables/path as user go to: Control Panel->User Accounts->Change My Environment variables

Upvotes: 0

Legna
Legna

Reputation: 468

Try this solution:

npm install -g --unsafe-perm nativescript

It seems to be a problem with path of the sudo. If you use sudo with tns you look in sudoer ~/.basrch, not in your user. And of course, theres not a $ANDROID_HOME path.

Upvotes: 1

Damian Hetman
Damian Hetman

Reputation: 382

The answer is: You can't run line in terminal with "sudo"... Without sudo ANDROID_HOME works but still emulator doesn't show.

Upvotes: 0

Please double check that you have done the following mistake in your bash profile :), If so please remove it.

export PATH=$PATH:$ANDROID_HOME/bin (no bin directory inside the Sdk)

Upvotes: 0

Dominic Lam
Dominic Lam

Reputation: 1

I experienced the same problem, however as a linux user. I received a "eacces permission denied" error when i use tns run android --emulator..

I then tried sudo tns run android --emulator and the error disappeared but i got this android_home not found instead...

Subsequently i resolved by changing permissions in my Sdk, so you might want to give it a shot..

Troubleshooting Steps
1) check $ANDROID_HOME variable using echo $ANDROID_HOME and make sure it points to your Sdk folder.. - If it is not, put the path into your bash profile as others have recommended.

2) If $ANDROID_HOME is valid, check if permissions is set to read, write and execute to make sure it's not a permission issue - I have a theory that if its a permission issue it might be because of the installation process..

Hope this helps...

Upvotes: 0

Related Questions