2

我正在阅读本教程:

http://docs.phonegap.com/en/2.9.0/guide_getting-started_android_index.md.html#Android%20Platform%20Guide

我刚刚在我的工作区中创建了这个项目:

cordova create hello2 com.example.hello2 "Hello World 2"

cd 进入目录

现在:

cordova platform add android

给我以下错误:

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

我的导出路径如下所示:

export PATH=${PATH}:/Documents/DevFolder/adt-bundle-mac-x86_64-20130522/sdk/platform-tools:/Documents/DevFolder/adt-bundle-mac-x86_64-20130522/sdk/tools

这条路有什么问题?

或者还有什么可能导致此错误。而且,是的,我确实安装了 Android SDK。根据这个:

http://developer.android.com/sdk/installing/bundle.html

4

3 回答 3

3

如评论中所述,问题与定义可执行文件的方式PATH有关。android有必要将这些路径定义为绝对路径。

至于Object has no method 'tmpDir'错误,谷歌快速搜索发现了以下补救措施:https ://groups.google.com/forum/#!msg/phonegap/sKQ3MRrIpNg/dV6WYOTDDf0J

于 2013-07-11T21:04:28.227 回答
1

这是一个旧线程,但我想我会提到这一点......您必须在〜/ .bash_profile中添加导出路径后打开一个新的终端窗口 - 然后“cordova平台添加android”工作。:)

于 2013-07-30T03:12:21.137 回答
0

这个对我有用

A - 打开文件 /Users//.bash_profile (例如从该文件夹运行命令 vim .bash_profile... 或简单地从 finder 找到隐藏文件并使用文本编辑器打开它)

B - 添加以下行,确保使其适应您的 ADT 文件夹名称和位置(在我的情况下,我将原始 adt-bundle-mac-x86_64-xxxxx 文件夹放入 Application 并重命名为 ADT)

导出 PATH=/Applications/ADT/sdk/tools:/Applications/ADT/sdk/platform-tools:$PATH

确保在最后添加 :$PATH

于 2013-10-25T12:20:46.897 回答