无法在命令行中运行android命令

时间:2021-04-25 00:10:37

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

我通过此命令设置了指向Android SDK工具的路径:

# 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:

当我回应$ PATH时,这就是我得到的:

/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:

然而,当我尝试运行cordova平台添加android我得到:

[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/

整个adt-bundle位于我的root用户目录中名为Development的目录中。确切的路径是/ Users / me / Development / adt-bundle /

What Am I missing?

我错过了什么?

2 个解决方案

#1


8  

What Am I missing?

我错过了什么?

You are missing two ~ characters, perhaps.

你可能缺少两个〜字符。

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

确切的路径是/ 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.

这不是你输入PATH的内容。你的PATH说没有/ Users /我 - 相反,PATH期望你的卷的根目录中有一个/ Development目录。

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

现在,在Linux中,解决方案是添加一个〜来表示/ Development与您的主目录相关:

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:

我的OS X shell体验很生疏,所以我忘记了〜是否会映射到/ Users / me。如果是,请使用〜,否则,请使用:

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

#2


0  

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

感谢@CommonsWare帮我解决了我的$ PATH问题。

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

除了解决方案之外,事实证明最新的ADT仅包含Android Target 18。

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

Phonegap v3.0.9似乎运行Android Target 17,所以我下载了它,它现在运行得非常好。

#1


8  

What Am I missing?

我错过了什么?

You are missing two ~ characters, perhaps.

你可能缺少两个〜字符。

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

确切的路径是/ 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.

这不是你输入PATH的内容。你的PATH说没有/ Users /我 - 相反,PATH期望你的卷的根目录中有一个/ Development目录。

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

现在,在Linux中,解决方案是添加一个〜来表示/ Development与您的主目录相关:

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:

我的OS X shell体验很生疏,所以我忘记了〜是否会映射到/ Users / me。如果是,请使用〜,否则,请使用:

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

#2


0  

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

感谢@CommonsWare帮我解决了我的$ PATH问题。

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

除了解决方案之外,事实证明最新的ADT仅包含Android Target 18。

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

Phonegap v3.0.9似乎运行Android Target 17,所以我下载了它,它现在运行得非常好。