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?
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.
From the error message, it looks like you need to add the Android home tools and platform tools folders to your $PATH
, ie
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.