简体   繁体   中英

Can't add android platform in cordova on Mac

I'm not sure what step I've missed, but I cannot get Cordova to add the android platform to my sample project.

This what I am getting from Terminal:

:hello2 my-username$ cordova platform add android
Creating android project...

/Users/my-username/.cordova/lib/android/cordova/3.4.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.

And this is what I have in my .bash_profile:

export PATH=${PATH}:/Users/my-username/Documents/Development/sdk/platform-tools:/Users/my-username/Documents/Development/sdk/tools

My /Development directory is set up like this:

/eclipse

/hello2

/sdk

Any help would be much appreciated.

A few ideas:

Check your ant installation is working ok with "ant -version".

Add the following to your bash profile (you may have ant installed somewhere else, so check/find your path in Finder first):

export PATH="${PATH}:/usr/share/ant/bin"

Reboot to apply the new shell paths.

Check your path output in your shell with: "echo $PATH" to ensure it is what you think it is.

I think you haven't define the path for android-sdk. Make sure you have installed latest updated version of android-sdk.

Path for android-sdk: -ANDROID_HOME (C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM