我是phonegap的新手。当我在phonegap中添加android时,我收到错误。我使用this steps来解决此错误,但我仍然收到此错误:
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occured during creation of android sub-project.
/Users/ss/.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/ss/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
at /Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/sss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
at /Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
at flush (/Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
at /usr/local/lib/node_modules/cordova/src/platform.js:244:30
at ChildProcess.exithandler (child_process.js:641:7)
答案 0 :(得分:1)
您必须将/pathToAndroidFolder/sdk/platform-tools
和/pathToAndroidFolder/sdk/tools
添加到$ PATH
nano ~/.bash_profile
添加此行
export PATH=${PATH}:/Users/ss/Documents/Software/adt-bundle-mac-x86_64-20130729/sdk/tools:/Users/ss/Documents/Software/adt-bundle-mac-x86_64-20130729/sdk/platform-tools
打开一个新的终端窗口使其工作,或使用此命令使其在当前终端窗口上工作:
source ~/.bash_profile
答案 1 :(得分:0)
PhoneGap Doc'上有逐步说明。您可以使用它来解决问题link
答案 2 :(得分:0)
对于OSX,您的路径需要包含/ Users / yourusername
他们的例子:/ Development / adt-bundle / sdk / platform-tools 需要是:/ Users / yourusername / Development / adt-bundle / sdk / platform-tools
使用echo $ PATH检查你的路径(使用大写,区分大小写!)