Missing NativeScript ANDROID_HOME
When I run tns run android
or tns doctor
, I get an error that the ANDROID_HOME environment variable is not set. However, this is clearly established. Mac OSX Sierra 10.12.3.
bash-3.2$ tns run android
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.
bash-3.2$ $ANDROID_HOME
bash: /Users/rlangton/Library/Android/sdk: is a directory
bash-3.2$
+3
source to share
2 answers
If you are using bash, you need to update the ~ / .bash_profile file. In my case, I am using ZSH, so I needed to edit the ~ / .zshrc file.
nano ~/.zshrc
Add the export line below:
if [ -f /Users/{myusername}/.tnsrc ]; then
source /Users/{myusername}/.tnsrc
export ANDROID_HOME=/Users/{myusername}/Library/Android/sdk
fi
Ctrl + O to save, Ctrl + Z to exit. Restart your terminal. Now echo $ANDROID_HOME
shows the correct path every time.
+2
source to share