user1367323
user1367323

Reputation: 401

While installing IONIC, ANDROID_HOME variable is set but getting 'Failed to find 'ANDROID_HOME' environment variable'

As the title states, I've set up the variable in my .bashrc like so

export ANDROID_HOME=$HOME/Android/Sdk
PATH=$PATH:$HOME/Android/Sdk:$HOME/Android/Sdk/tools

export PATH

and shows fine when I do:

printenv ANDROID_HOME

/home/chris/Android/Sdk

printenv PATH also shows the right paths.

I can cd into that directory and go into the tools directory and run ./android and it works fine (it's there).

However, doing:

ionic build android

(in a separate directory, same shell) I get:

Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

I have re-installed IONIC and re-installed the Android SDK as well.. Any ideas?

Ubuntu 16.10 64bit

Thanks.

Upvotes: 0

Views: 529

Answers (1)

user1367323
user1367323

Reputation: 401

Ok I figured it out, I was trying to

sudo ionic build android

instead of just

ionic build android

..and sudo has a different set of env variables. Learn something new everyday!

I started to use sudo because I was getting some permission denied errors, but it should've all been cleared, instead of resorting to super user!

Upvotes: 2

Related Questions