我已将在Windows 7上运行的Phonegap升级到当前最新版本到3.3.0。我可以创建一个没有任何问题的项目但是当我尝试添加一个平台说“android”时会发生错误。下面显示的是我在Windows 7上的命令promt上运行“cordova platform add android”命令时得到的错误。请帮忙。
E:\Dropbox\Development\Android\weatherlk>cordova platform add android
Creating android project...
C:\Users\Teshan\AppData\Roaming\npm\node_modules\cordova\node_modules\q\
throw e;
^
Error: An error occured during creation of android sub-project.
C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.
throw e;
^
Error: An error occurred while listing Android targets
at C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\lib\check_
at _rejected (C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin
at C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\node_modul
at Promise.when (C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\
at Promise.promise.promiseDispatch (C:\Users\Teshan\.cordova\lib\and
752:41)
at C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\node_modul
at flush (C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\nod
at process._tickCallback (node.js:415:13)
at C:\Users\Teshan\AppData\Roaming\npm\node_modules\cordova\src\plat
at ChildProcess.exithandler (child_process.js:641:7)
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)
答案 0 :(得分:2)
我今天遇到了这个问题。原来我在\ android-sdk \ tools的路径变量中有空格(在windows 7环境变量中)。检查android批处理文件是否运行,即在任何目录中的命令提示符下键入android,以及平台工具路径的adb。这里回答了类似的问题< An error occured during creation of android sub-project>。
答案 1 :(得分:0)
这是一篇关于从头到尾安装它的博客,其内容比phonegap / cordova docs提供的更详细。比拼凑不同的堆栈问题容易得多:http://www.andrewsavory.com/blog/2013/2517