PhoneGap在Mac上安装

时间:2014-05-20 13:47:38

标签: android cordova

我对此次安装感到有些恼火。我已经按照here的说明操作了,我已经将Android添加为平台,当我尝试运行它时,大量的代码是从我的终端复制并粘贴的。我在~/Development/sdk/ ~ is the home directory for the user

安装了Android SDK
Donalds-MacBook-Air:hello donaldsutherland$ cordova platform add android
Creating android project...

/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.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/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:85:29
    at _rejected (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
    at /Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
    at Promise.when (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
    at /Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
    at flush (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:419:13)
Error: /Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:126:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:753:16)
    at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Donalds-MacBook-Air:hello donaldsutherland$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/your-path/android-sdk-linux/platform-tools:/your-path/android-sdk-linux/tools:/Development/android-sdk-linux/platform-tools:/Development/android-sdk-linux/tools:/Development/sdk/platform-tools:/Development/sdk/tools
Donalds-MacBook-Air:hello donaldsutherland$ 

如果我运行$ cordova platforms ls,则列出Available platforms: amazon-fireos, android, blackberry10, firefoxos, ios

1 个答案:

答案 0 :(得分:2)

创建个人资料文件~/.bash_profile

编写此行以将android SDK文件夹添加到PATH

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

关闭终端并再次打开它,然后它应该识别“android”命令到处