The ANDROID_HOME error is not set and the "android" command is missing from your PATH
On startup, sudo cordova build
I installed Ubuntu 14.1 X86_64 :
[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/infra/workspaces/mobileprojectsap/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
in mine .bash_profile
I have:
export ANDROID_HOME=/home/infra/MyPrograms/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools
export PATH=${PATH}:$ANDROID_HOME/platform-tools
when i run
echo $ANDROID_HOME
appears /home/infra/MyPrograms/android-sdk-linux
Do I need to do something else? any ideas?
thank
Alejo
Just start cordova build
without sudo
. Using the root user overrides yours .bash_profile
and therefore ANDROID_HOME is not set appropriately.
In case you actually need root access, change it to root using the command su
and edit the Bash profile.
Do you really need to use sudo
? The problem here is that environment variables are not available unless you sudo
, if you didn't specify the option -E
on sudo
.
See here for details on how to save environment variables with sudo -E
or do
sudo visudo
Defaults env_keep += "ANDROID_HOME"
I run sudo echo $ANDROID_HOME
and the variable is not set.
I ran cordova build
it and it worked well.
I am new to using Linux.
Thanks a lot everyone for the quick response