Reputation: 5451
phonegap build android
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project.
/Users/MYMacbook/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126 throw e; ^ Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.
I have the latest sdk updated. yet the error haunts again and again . Any idea?
Upvotes: 1
Views: 364
Reputation: 1651
From the error message, it looks like you need to add the Android home tools and platform tools folders to your $PATH
, i.e.
export ANDROID_HOME="/path/to/your/sdk-folder" # e.g. "/Applications/Android\ Studio.app/sdk"
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
and then run source ~/.bash_profile
or source ~/.profile
based on which one you used.
Then you'll need to run phonegap install android
before you do build
.
Finally, it would probably help you to update phonegap/cordova; I'm guessing you have it installed via npm so run (fix sudo if necessary):
npm cache clean
npm update -g
Android platform guide for reference.
Upvotes: 3
Reputation: 5451
Using this link, my project built : http://docs.phonegap.com/en/3.4.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide
Upvotes: 0
Reputation: 457
it looks like a path issue, so Phonegap CLI scripts cannot reach to the Android toolchain.
Have you followed the Phonegap Android guide here? Most importantly this part:
export PATH=${PATH}:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools
Best.
Upvotes: 3