简体   繁体   English

Cordova / PhoneGap构建错误

[英]Cordova/PhoneGap Build Error

I am getting the following error when I am trying to build my phonegap project. 尝试构建phonegap项目时出现以下错误。

D:\LWMobile\hello>cordova build android
.
.
.

BUILD FAILED
C:\AndroidSDK\adtbundle\sdk\tools\ant\build.xml:601: The following
d while executing this line:
C:\AndroidSDK\adtbundle\sdk\tools\ant\build.xml:720: The following
d while executing this line:
C:\AndroidSDK\adtbundle\sdk\tools\ant\build.xml:734: Class not foun

Total time: 2 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,D:\LWMo
atforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=an
Error: D:\LWMobile\hello\platforms\android\cordova\build.bat: Comma
h exit code 2
    at ChildProcess.whenDone (C:\Users\aniruddha.b\AppData\Roaming\
les\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

I am on 64-bit machine and have installed JDK 8 64-bit. 我在64位计算机上,已经安装了64位JDK 8。 The following are my system path variables: 以下是我的系统路径变量:

ANT_HOME: C:\Users\aniruddha.b\AppData\Roaming\npm\node_modules\ant\ant
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_20
CLASSPATH: C:\Program Files\Java\jdk1.8.0_20\lib

PATH: %JAVA_HOME%\bin;
C:\AndroidSDK\adtbundle\sdk\platform-tools;
C:\AndroidSDK\adtbundle\sdk\tools;
C:\Program Files\nodejs\;
%ANT_HOME%\bin;

My Project path is: D:\\LWMobile\\hello 我的项目路径是:D:\\ LWMobile \\ hello

"hello" is the project folder “ hello”是项目文件夹

The issue was with the incompatibility of the Ant version with my Java version. 问题在于Ant版本与Java版本不兼容。

Ant version I have is 1.8.4. 我拥有的Ant版本是1.8.4。 Initially, I had JDK 8 - which supports only Ant 1.9 & greater 最初,我有JDK 8-仅支持Ant 1.9及更高版本

Therefore, I uninstalled JDK8 and reverted back to JDK7 因此,我卸载了JDK8并恢复为JDK7

Yes, I could have rather updated Ant itself. 是的,我本来可以更新Ant本身。 That is also an option. 这也是一种选择。 However, I particularly needed Ant1.8 但是,我特别需要Ant1.8

The issue is with the incompatibility of the Ant version with your Java version. 问题在于Ant版本与Java版本不兼容。

Ant version you have is 1.8.4. 您拥有的Ant版本是1.8.4。 JDK 8 - supports only Ant 1.9 & greater JDK 8-仅支持Ant 1.9及更高版本

Uninstall JDK8 and revert back to JDK7 卸载JDK8并恢复为JDK7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM