11

I'm trying to set up a phonegap project and while trying to add a platform it outputs the following error:

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've tried what I've read here: How do I set environment variables on OS X?

and wrote the following in the .profile file:

export PATH=/users/ophir/android-sdks/tools

while it did add the android command to my path and I was able to run it and get a response, I started noticing that a simple "ls" command suddenly didn't work - until I removed what I have done.

how can I add another path to the PATH variable? how does it all work on OS X anyhow?

thanks

13

Your command replaces the entire path variable with your path, thereby removing folders such as /bin. You need to add your path to the existing path, not replace it:

export PATH=/users/ophir/android-sdks/tools:$PATH

Alternatively, so that you don't replace the tools found in folders that are in your existing path, you can add your new folder to the end of the path variable:

export PATH=$PATH:/users/ophir/android-sdks/tools
  • Thanks. That did the trick. how can I add more then one path? delimit with ; ? – developer82 Jan 29 '14 at 9:14
  • 1
    @developer82 Delimit with :/path/1:/path/2:$PATH – grg Jan 29 '14 at 9:15
  • 2
    Yes, delimit the different paths with ':'. I also like to add the new path to the end rather than the beginning so I do export PATH=$PATH:/users/ophir/android-sdks/tools - it means you can't accidentally replace one of the system tools as they will be found first. – Tony Williams Jan 29 '14 at 9:17
  • @grgarside i got this error "An error occured during creation of android sub-project. /bin/sh: /Users/****/.cordova/lib/android/cordova/3.3.0/bin/create: No such file or directory" – Charan Giri Feb 10 '14 at 6:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .