Phonegap:在创建android子项目期间发生错误。 (OS X)

时间:2014-02-19 15:34:45

标签: android cordova

我正在学习如何在this guide.

之后使用phonegap

但是当我尝试做$ phonegap build android时,这就是我所得到的:

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
  [error] An error occured during creation of android sub-project. 

/Users/myself/.cordova/lib/android/cordova/3.3.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.
at /Users/myself/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/myself/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
at /Users/myself/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/myself/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/myself/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
at /Users/myself/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
at flush (/Users/myself/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)

有什么想法吗?

PS:

我是带有phonegap,ruby和npm的noob

1 个答案:

答案 0 :(得分:1)

如果未正确设置Android SDK,则会收到此错误。应将Android SDK工具和平台工具文件夹Ant和Java JDK添加到PATH。

将Android SDK添加到PATH解决了这个问题。