我知道你在想什么。不,这不是你会看到的任何常见错误。我正在研发Macbook,仅供参考。我第一次使用cordova / phonegap / ionic / angularjs / mongodb / nodejs,当我开始一个新项目时,我收到了这个错误:
MacbookThrone:hello neema$ sudo cordova platform add android
Creating android project...
/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/neema/.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/neema/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/neema/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
它就像那样继续下去。我读到一个解决方案可能是运行它:
MacbookThrone:hello neema$ phonegap build android
但是这只是抛出了这个错误:
MacbookThrone:hello neema$ 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/neema/.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/neema/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/neema/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
at /Users/neema/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/neema/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/neema/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
at /Users/neema/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
at flush (/Users/neema/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
我真的不知道该怎么做。谁能提供任何见解?我找到了这些解决方案,但我无法弄清楚如何使用它们......
Getting error when adding Android to Phonegap project
Phonegap 3 doesn't work with Android Studio
编辑<<<< 这个解决方案可行!我打算尝试一下让你知道> http://docs.phonegap.com/en/2.8.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android
答案 0 :(得分:0)
我只需要在.bash_profile文件中添加正确的路径。起初它很混乱,但现在我明白了。