Reputation: 251
When i run for android, i see this error :
ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
But this "variable" are ok. "Android" launch SDK manager and ANDROID_HOME redirect to my sdk folder.
I don't understand this error.
FYI my export :
export ANDROID_HOME=`brew --prefix android`
export PATH=${PATH}:$ANDROID_HOME/bin
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Upvotes: 14
Views: 32196
Reputation: 844
For anybody like me who has tried everything in the answers and have all the environmental variables set up but still gets an error. You might need to remove and add the android platform to your project with the cordova CLI.
cordova platform rm android
cordova platform add android
Upvotes: 0
Reputation: 133
For me following steps work :
sudo chown -R your-user /usr/local/lib/node_modules/cordova
export PATH=$PATH:/users/your-user/android-sdks/tools
and then update your android if it is not updated to latest version.
http://blog.codersight.com/2015/05/error-androidhome-is-not-set-and.html
Upvotes: 0
Reputation: 31
Ubuntu 14.04 gedit /root/.bashrc add line
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
ANDROID_HOME=/root/android/sdk/
export ANDROID_HOME=$ANDROID_HOME
PATH=$PATH:$ANDROID_HOME/tools
PATH=$PATH:$ANDROID_HOME/platform-tools
PATH=$PATH:$ANDROID_HOME/build-tools
IN TERMINAL source ~/.bashrc
Resolveu pra mim/Solved for me!
Upvotes: 3
Reputation: 11025
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.
Upvotes: 0
Reputation: 76
Took me longer than I care to admit to solve this problem, so I thought I'd share how I got this working on Mac for the more novice users such as myself and also those who have not installed with Homebrew:
1) Open your bash profile file (the path to finding this file is 'User/.bash_profile', the name of your file may be .profile or something similar).
2) Add a path to wherever you have saved the Android SDK (you may add something like this: 'export PATH=${PATH}:/Applications/adt-bundle/sdk/platform-tools:/Applications/adt-bundle/sdk/tools' or you may add something like this: 'export PATH=${PATH}:/Desktop/adt-bundle/sdk/platform-tools:/Desktop/adt-bundle/sdk/tools').
Make sure the file name 'adt-bundle' shown in the path above is the name you have saved for the folder! If it isn't, either save the folder with this name, or alter the path to reflect what you have saved the folder as.
3) Try again. You might encounter some further errors, I resolved mine by visiting this page: Cordova 3.5.0 Install Error- Please Install Android Target 19 I typed 'Android' in the terminal to head straight to the package manager in Eclipse. After installing the required version the command worked and installed the Android package to my Cordova application.
I found the following pages very helpful in coming to the above conclusions:
-Understanding the path (needed a refresher on using path! Last time I had to bother with this was ages ago when installing the rbenv Ruby environment): http://help.exercism.io/understanding-path.html
-Setting up for Android (where I found the path): http://docs.phonegap.com/en/edge/guide_platforms_android_index.md.html#Using%20Plugman%20to%20Manage%0APlugins
No 'sudo' required.
Upvotes: 1
Reputation: 251
I answer me !
My solution :
sudo chown -R your-user /usr/local/lib/node_modules/cordova
Remove and add platform
Upvotes: 11
Reputation: 1847
When my environment is OK (which means that running 'android' via CLI will open the android sdk manager), but I still get this error...
I do the follow:
1 - Remove the platform Android from your project cordova platform remove android
2 - Then I just run again phonegap run android
(it'll add the platform Android automatically)
Upvotes: 1