I\'m trying to install PhoneGap and I\'m getting the following error:
Error: ANDROID_HOME is not set and "android" command not in your PATH. Yo
On Linux, add this to the end of your .bashrc, .profile or appropriate file for your shell:
export ANDROID_HOME=/home/youruser/whatever/adt-bundle-linux-x86_64-20140702/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
Please notice that these environment variables will be available for newly created shells, not the already open.
Using Android Studio on Windows the system variables settings have changed a little.
You still have to add a system variable ANDROID_HOME
, but pointing to the directory containing the android SDK usually installed in C:\Users\YOUR_USERNAME\AppData\Local\Android\android-studio\sdk
.
You also need to add the following to the Path
system variable:
;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
Taken from: https://github.com/simnova/webdevdocs/wiki/Installing-PhoneGap-and-Android-Studio-on-Windows
SDK Path also be in C:\Users\USER\AppData\Local\Android\sdk
ANDROID_HOME
is deprecated now instead of using ANDROID_HOME
use ANDROID_SDK_ROOT
as per Google android documentation -
ANDROID_SDK_ROOT
sets the path to the SDK installation directory. Once set, the value does not typically change, and can be shared by multiple users on the same machine. ANDROID_HOME, which also points to the SDK installation directory, is deprecated.
If you continue to use it, the following rules apply:
ANDROID_HOME
is defined and contains a valid SDK installation, its value is used instead of the value in ANDROID_SDK_ROOT
.ANDROID_HOME
is not defined, the value in ANDROID_SDK_ROOT
is used.ANDROID_HOME
is defined but does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT
is used instead.For details follow this Android Documentation link
Android path set in linux:
$export ANDROID_HOME=/usr/lib/android-sdk-linux
$export PATH=$PATH:$ANDROID_HOME/tools
$export PATH=$PATH:$ANDROID_HOME/platforms-tools
than
$cordova run android
By the way, one other possibility is that you do have a too old version of cordova android platform.
Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Then:
cordova platform update android --save
if Linux users still have the same error, probably they have used "sudo" for adding android platform.. a quick solution for this here, or you have installed cordova using sudo, also there is a solution for this problem here.
Hope this help!