我试图设置一个phonegap项目,但我似乎无法为其添加平台。当我尝试添加android时,我收到以下错误消息:
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
at C:\Users\spacitron\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:4
7:27
at exithandler (child_process.js:643:7)
at ChildProcess.errorhandler (child_process.js:659:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:805:12)
Error: C:\Users\spacitron\.cordova\lib\android\cordova\3.4.0\bin\create.bat: Command
failed with exit code 8
at ChildProcess.whenDone (C:\Users\spacitron\AppData\Roaming\npm\node_modules\co
rdova\src\superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
这对我来说没有多大意义,因为当我跑步"和-version"我得到以下内容:
Apache Ant<TM> version 1.9.4 compiled on April 29 2014
那么我可能会在这里失踪什么?
答案 0 :(得分:0)
正如你的错误所说它无法找到你的蚂蚁。 您需要在环境变量中添加路径
PATH
;%JAVA_HOME%\ bin中;%ANT_HOME%\ bin中;%ANDROID_SDK%;%ANDROID_ADB%;
(您还可以在about命令中添加绝对路径)
ANT_HOME
C:\Program Files\Java\ant\
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_25
ANDROID_SDK
C:\Android\sdk\tools
ANDROID_ADB
C:\Android\sdk\platform-tools
运行这四个命令来检查每件事情是否正确设置
adb
android
javac
ant
创建项目命令 移动到phonegap android文件夹。按Shift +右键单击并选择&#34;在这里打开命令窗口&#34;
create Path_to_Project Package_Name Project_Name
create C:\Users\YourUsername\Desktop com.talha.test HelloWorld