我通过以下方式开始了一个新的Cordova项目:
cordova create project com.pro.ject Project
当我添加:
cordova platform add android
我收到了错误:
Downloading cordova library for android...
Download complete
Creating android project...
C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.
js:126
throw e;
^
Error: An error occurred while listing Android targets
at C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\lib\check_
reqs.js:87:29
at _rejected (C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin
\node_modules\q\q.js:808:24)
at C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\node_modul
es\q\q.js:834:30
at Promise.when (C:\Users\myself\.cordova\lib\android\cordova\3.5.1\
bin\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\myself\.cordova\lib\and
roid\cordova\3.5.1\bin\node_modules\q\q.js:752:41)
at C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\node_modul
es\q\q.js:574:44
at flush (C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\nod
e_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\myself\AppData\Roaming\npm\node_m
odules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5
同时Eclipse可以成功创建phonegap项目并将其编译为android,但cordova.exe无法识别Eclipse创建的项目作为Cordova项目。
答案 0 :(得分:3)
添加两个
\ android-sdks \ tools
和
\ android-sdks \ platform-tools
到你的路径,它的工作原理
答案 1 :(得分:0)
以下是使用cordova创建新项目的示例错误,
cordova create abc com.example.abc ABC
abc与com.example.abc相同,如果项目创建没有错误,当你构建应用程序时会显示如上所述的奇怪错误。希望这可以帮助别人。