所以我要疯了 - 谈到cordova/phonegap时似乎是无止境的。
在 Mac OS X 小牛上,我正在尝试将 android 添加为平台...
所以自然而然的去...
$ cordova platform add android
我得到这个错误...
Creating android project...
Error: An error occured during creation of android sub-project.
/Users/jasonstockton/.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/jasonstockton/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/jasonstockton/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
at /Users/jasonstockton/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/jasonstockton/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/jasonstockton/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
at /Users/jasonstockton/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
at flush (/Users/jasonstockton/.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:282:30
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
在您继续给我“您需要添加路径”响应之前。我已经这样做了(因此我失去了理智)。
我的 .bash_profile 看起来像这样......
export PATH=/usr/local/bin:$PATH
export PATH=${PATH}:/Development/adt-bundle-mac/sdk/platform-tools:/Development/adt-bundle-mac/sdk/tools
export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH
注意第二行是平台工具。我也试过把其他物品拿出来,但没有运气。每次更新后我都调用 source ~/.bash_profile - 也重新启动了终端和计算机,但没有运气。
为了谨慎起见,我通过终端检查了所有文件,以防万一发生了不可能的事情,而 Finder 在目录上撒谎。文件似乎都在那里...
Jasons-MacBook-Pro:~ jasonstockton$ cd Development/adt-bundle-mac/sdk/platform-tools
Jasons-MacBook-Pro:platform-tools jasonstockton$ ls
NOTICE.txt adb api fastboot source.properties systrace
Jasons-MacBook-Pro:platform-tools jasonstockton$ cd
Jasons-MacBook-Pro:~ jasonstockton$ cd Development/adt-bundle-mac/sdk/tools
Jasons-MacBook-Pro:tools jasonstockton$ ls
Jet apps emulator-arm emulator64-x86 lib proguard traceview
NOTICE.txt ddms emulator-mips etc1tool lint source.properties uiautomatorviewer
adb_has_moved.txt dmtracedump emulator-x86 hierarchyviewer mksdcard sqlite3 zipalign
android draw9patch emulator64-arm hprof-conv monitor support
ant emulator emulator64-mips jobb monkeyrunner templates
然后我继续谷歌搜索,发现另一条建议也建议更新 .profile 文件。我的 .profile 文件看起来像这样......
PATH=$PATH:/Development/adt-bundle-mac/sdk/platform-tools:/Development/adt-bundle-mac/sdk/tools
export PATH
仍然得到同样的错误。我尝试在其他应用程序上运行呼叫,但仍然遇到问题。
我在其他地方读到调用 set 来查看它是否真的被设置了......这就是我设置的路径的样子......
PATH=/Applications/MAMP/bin/php/php5.5.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Development/adt-bundle-mac/sdk/platform-tools:/Development/adt-bundle-mac/sdk/tools
如果有人能阐明我可能做错了什么,那就太棒了!我非常迷茫和困惑。该应用程序已为 iOS 做好准备,只是想为 android 制作一个版本。应该直截了当...
提前感谢你的帮助!