我需要一些帮助或建议。当我尝试通过cmd行构建我的phonegap应用程序时,我遇到如下所示的错误。
c:\myapplication>phonegap build android
[phonegap] executing 'cordova platform add --save android'...
[phonegap] completed 'cordova platform add --save android'
[phonegap] executing 'cordova build android'...
Running command: c:\myapplication\platforms\android\cordova\build.bat
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_75
Running: c:\myapplication\platforms\android\gradlew cdvBuildDebug -b
c:\myapplication\platforms\android\build.gradleDorg.gradle.daemon=true
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
ERROR building one of the platforms: Error:
c:\myapplication\platforms\android\cordova\build.bat: Command failed
with exit code 1
You may not have the required environment or OS to build this project
Error: c:\myapplication\platforms\android\cordova\build.bat: Command
failed with exit code 1 at ChildProcess.whenDone
(C:\Users\Owner\AppData\Roaming\npm\node_modules\phonegap\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
c:\myapplication>
所需的所有工具都是正确的,但无法弄清楚可能是什么原因。请帮忙。欢迎提出意见。
答案 0 :(得分:1)
如果您想使用命令行,我建议您使用本文档并按照步骤
Cordova Command Line Interface
1.下载并安装Node.js
2.下载并安装git客户端。
确保将它们添加到Windows中的Path中
3.安装cordova
npm install -g cordova
4.创建应用程序文件夹
cordova create hello com.example.hello HelloWorld
cd hello
5.添加平台
cordova platform add android
6.构建应用程序
cordova build
7.运行应用程序
cordova emulate android