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
For those who are working with Ionic Framework on windows and doesn't have andorid studio installed on their PCs, you must have either download Android Studio or at list download the SDK Manager.
If you choose the SDK Manager option you have to set the path for the Enviroment Variable:
Variable name: ANDROID_HOME
, Variable value: the path where you installed the android SDK, in my case is, C:\Android\android-sdk
.
You have to add the variable to the Path variable system by adding this:
;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
.
Then if you got the "JDK error" just download it from the Oracle website and create a system variable like the Android SDK:
Variable name: JAVA_HOME
, Variable value: the path where you installed the JDK, in my case is, C:\Program Files\Java\jdk1.8.0_144
. Then add it to the Path variable system by adding ;%JAVA_HOME%\bin
.
Then if you got the "Gradle error" just fallow the installations steps on the official website of gradle.
Finally you can continue to creating your ionic app's apk.
Note: you have to reopen the cmd window several times or restart your pc after making those changes. Hope this work for you.
Only one change was needed to fix the problem:
Go to Start -> Control Panel -> System -> Advanced(tab) -> Environment Variables -> System Variables
set ANDROID_HOME
to C:\Program Files (x86)\Android\android-sdk
I have MAC OS X Yosemite, Android Studio 1.0.1, JDK 1.8, and Cordova 4.1.2
When I tried to add the android project:
cordova platforms add android
I received the message: ANDROID_HOME is not set and "android" command not in your PATH
Based in cforcloud's answer... 'Error: the command "android" failed' using cordova and http://developer.android.com/sdk/installing/index.html?pkg=studio I used the following:
export ANDROID_HOME="/Users/<user_name>/Library/Android/sdk"
export ANDROID_TOOLS="/Users/<user_name>/Library/Android/sdk/tools/"
export ANDROID_PLATFORM_TOOLS="/Users/<user_name>/Library/Android/sdk/platform-tools/"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
echo $PATH
When I tried to create the android project, I received this message:
Creating android project...
/Users/lg/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:126
throw e;
^
Error: Please install Android target "android-19".
I ran Android SDK Manager, and installed Android 4.4.2 (API 19) (everything but Glass Development Kit Preview). It worked for me.
===
This is the content of my .bash_profile file.
export PATH=$PATH:/usr/local/bin
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
launchctl setenv STUDIO_JDK /library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
export ANDROID_HOME="/Users/<UserName>/Library/Android/sdk"
export ANDROID_TOOLS="/Users/<UserName>/Library/Android/sdk/tools"
export ANDROID_PLATFORM_TOOLS="/Users/<UserName>/Library/Android/sdk/platform-tools"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
To edit .bash_profile using Terminal, I use nano. It is easy to understand.
cd
nano .bash_profile
I hope it helps.
In Linux,
edit .bashrc
file and add the ANDROID_HOME
and PATH
variable,
export ANDROID_HOME=/usr/local/android-sdk-linux/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
After saving .bashrc
file, run
source ~/.bashrc
then in type
android
in a terminal
if it will run, ANDROID_HOME
and PATH
is set,
if you get this message,
bash: /src/android-sdk/tools/android: Permission denied
then run
sudo chmod a+x /usr/local/android-sdk-linux/tools/android
otherwise you will get same error message
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.
NB: Use your android sdk installation path instead of /usr/local/android-sdk-linux/
I had to close and re-open my windows console (or open a new console), and then open the SDK manager (ran android
), after which a bunch of updates and installs had to complete.
Using Android Studio on Mac, run this on your terminal:
export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
Then, when you type
android
at your terminal, it will run something