Reputation: 1328
I get this error:
Failed to find 'ANDROID_HOME' environment variable. Try setting it manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
This happens because I have on .bashrc
the $ANDROID_HOME
and $PATH
set up, but when I run sudo ionic cordova build --release android
doesn't detect it to me. What should I do?
Upvotes: 0
Views: 236
Reputation: 9891
My guess is that your sudo
is not configured to keep the PATH
(see env_keep
in sudoers). So when running a command using sudo
, there is not ANDROID_HOME
defined anymore.
A quick way to find out is to run sudo env | grep -i android
.
To solve the problem, many ways:
sudo
setting so your PATH
environment variable is left unchanged (using env_keep
in settings, google is your friend);ANDROID_HOME
variable in /root/.profile
or /etc/profile
, etc.Upvotes: 2