lorenzoid
lorenzoid

Reputation: 1832

Trouble running android command in command line

I've set up my paths to point to the Android SDK tools via this command:

# Cordova command line tools for Android SDK ----------------------
export PATH=${PATH}:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools

When I echo out the $PATH, this is what I get:

/Users/lorenzoignacio/.rvm/gems/ruby-2.0.0-p0/bin:/Users/lorenzoignacio/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/lorenzoignacio/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/lorenzoignacio/.rvm/bin:/usr/local/bin:/usr/local/heroku/bin:/usr/local/share/npm/bin:/Users/lorenzoignacio/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/go/bin:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools

If you look at the end of it, you see my path:

/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools

And yet when I try to run the cordova platform add android I get:

[Error: The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: /bin/sh: android: command not found]

The entire adt-bundle is located in my root user directory in a directory called Development. The exact path is /Users/me/Development/adt-bundle/

What Am I missing?

Upvotes: 1

Views: 6142

Answers (2)

lorenzoid
lorenzoid

Reputation: 1832

Thanks to @CommonsWare for helping me out with my $PATH issues.

In addition to the solution, it turns out that the latest ADT only contains Android Target 18.

Phonegap v3.0.9 seems to run Android Target 17, so I downloaded that and it now works wonderfully.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006614

What Am I missing?

You are missing two ~ characters, perhaps.

The exact path is /Users/me/Development/adt-bundle/

That's not what you typed into your PATH. Your PATH says that there is no /Users/me -- instead, PATH is expecting a /Development directory in the root of your volume.

Now, in Linux, the solution would be to add a ~ to indicate that /Development is relative to your home directory:

export PATH=${PATH}:~/Development/adt-bundle/sdk/platform-tools:~/Development/adt-bundle/sdk/tools

My OS X shell experience is rusty, so I forget if ~ will map to /Users/me or not. If it does, use ~, otherwise, go with:

export PATH=${PATH}:/Users/me/Development/adt-bundle/sdk/platform-tools:/Users/me/Development/adt-bundle/sdk/tools

Upvotes: 8

Related Questions