[英]Cordova Platform Add Android Exception
When calling cordova platform add android
in the Windows 8 cmd, the error message ERROR : executing command 'ant', make sure you have ant installed and added to your path
is thrown. 在Windows 8 cmd中调用
cordova platform add android
时,错误消息ERROR : executing command 'ant', make sure you have ant installed and added to your path
中。 I have looked through quite a few other StackOverflow posts related to this problem, but continue to receive the same error message. 我已经浏览了许多其他与此问题相关的StackOverflow帖子,但是继续收到相同的错误消息。 I have installed node.js and GIT as specified in the documentation here: http://cordova.apache.org/docs/en/3.5.0//guide_cli_index.md.html#The%20Command-Line%20Interface .
我已经按照此处的文档中的说明安装了node.js和GIT: http : //cordova.apache.org/docs/en/3.5.0//guide_cli_index.md.html#The%20Command-Line%20Interface 。 I have also installed ant and added ant, Android tools, and Android platform tools to the user PATH system variable.
我还安装了ant并将ant,Android工具和Android平台工具添加到用户PATH系统变量中。 Here is the current PATH variable:
这是当前的PATH变量:
%ANT_HOME%\\bin;%JAVA_HOME%\\bin;C:\\apache-ant-1.9.4\\bin;C:\\apache-ant.1.9.4;%ANDROID_HOME%;C:\\Users\\t-alboul\\Desktop\\adt-bundle-windows-x86_64-20140702\\sdk\\tools;C:\\Users\\t-alboul\\Desktop\\adt-bundle-windows-x86_64-20140702\\sdk\\platform-tools;C:\\Users\\t-alboul\\Desktop\\adt-bundle-windows-x86_64-20140702\\sdk\\tools\\ant;C:\\Users\\t-alboul\\AppData\\Roaming\\npm
ANT_HOME: C:\\apache-ant-1.9.4
JAVA_HOME: C:\\Progra~1\\Java\\jdk1.8.0_05
ANDROID_HOME: C:\\Users\\t-alboul\\Desktop\\Eclipse\\adt-bundle-windows-x86_64-20140702\\sdk
What else could I try to solve this problem? 我还能尝试解决什么问题? Is there anything else that I should add to the PATH variable?
还有什么我应该添加到PATH变量中的吗?
Try installing ant with npm instead 尝试改为使用npm安装ant
npm install -g ant
npm install -g ant
and add C:\\Users\\ (your user name)\\AppData\\Roaming\\npm\\node_modules\\ant\\ant\\bin to the PATH 并将C:\\ Users \\(您的用户名)\\ AppData \\ Roaming \\ npm \\ node_modules \\ ant \\ ant \\ bin添加到PATH
I see in your path you have 我在你的路上看到你有
So where is actually tour ant package? 那么旅行蚁包到底在哪里呢? C:\\apache- ant-1 .9.4 or C:\\apache- ant.1 .9.4 becase in case it's the second, nothing in your path points to the bin folder.
C:\\ apacheant -1 .9.4或C:\\ apacheant.1 .9.4如果是第二个,则路径中的任何内容都不会指向bin文件夹。
I strongly suggest you clean up your path and make sure your env vars point to the good folders. 我强烈建议您清理路径,并确保环境变量指向正确的文件夹。
What you need in your path for cordova android is 您在Cordova Android的道路上需要的是
%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%JAVA_HOME%\bin;%ANT_HOME%\bin
To check if ant is accessible from the path, open a cmd and run ant -version
which should display Apache Ant(TM) version 1.9.4 compiled ...
要检查是否可以从路径访问ant,请打开cmd并运行
ant -version
,该命令应显示已Apache Ant(TM) version 1.9.4 compiled ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.