我是Cordova& amp;机器人。
我只是想通过命令设置一个项目。
$ cordova create hello com.example.hello "HelloWorld"
$ cd hello
$ cordova platform add android
These all ran successfully. But when i go for `$ cordova build android` then it throws errors.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Lodha>cd\
C:\>cd hello
C:\hello>cordova build android
Running command: C:\hello\platforms\android\cordova\build.bat
Buildfile: C:\hello\platforms\android\build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 23.0.2
[checkenv] Installed at C:\AndroidSdk\sdk
-setup:
[echo] Project Name: HelloWorld
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 20.0.0
[echo] Resolving Build Target for HelloWorld...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for HelloWorld...
[dependency] Library dependencies:
[dependency]
[dependency] ------------------
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
nodeps:
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 23.0.2
[checkenv] Installed at C:\AndroidSdk\sdk
-setup:
[echo] Project Name: CordovaLib
[gettype] Project Type: Android Library
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 20.0.0
[echo] Resolving Build Target for CordovaLib...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\hello\platforms\android\CordovaLib\ant-build\rsObj
[mkdir] Created dir: C:\hello\platforms\android\CordovaLib\ant-build\rsLibs
[echo] ----------
[echo] Resolving Dependencies for CordovaLib...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Found new input file
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
BUILD FAILED
C:\AndroidSdk\sdk\tools\ant\build.xml:601: The following error occurred while ex
ecuting this line:
C:\AndroidSdk\sdk\tools\ant\build.xml:720: The following error occurred while ex
ecuting this line:
C:\AndroidSdk\sdk\tools\ant\build.xml:734: Class not found: javac1.8
Total time: 1 second
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\hello\platforms\a
ndroid\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: C:\hello\platforms\android\cordova\build.bat: Command failed with exit co
de 2
at ChildProcess.whenDone (C:\Users\Lodha\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
C:\hello>
即使我尝试运行ant
或ant clean
,也说
Buildfile: build.xml does not exist!
Build failed
如果尝试使用ant
对ant -diagnotics
进行诊断,则会抛出,
C:\hello>ant -diagnostics
------- Ant diagnostics report -------
Apache Ant(TM) version 1.8.4 compiled on May 22 2012
-------------------------------------------
Implementation Version
-------------------------------------------
core tasks : 1.8.4 in file:/C:/Users/Lodha/AppData/Roaming/npm/node_modules/
ant/ant/lib/ant.jar
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
ant.java.version: 1.8
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant.ja
r
ant.home: C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\bin\..
-------------------------------------------
ANT_HOME/lib jar listing
-------------------------------------------
ant.home: C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\bin\..
ant-antlr.jar (11550 bytes)
ant-apache-bcel.jar (14548 bytes)
ant-apache-bsf.jar (9733 bytes)
ant-apache-log4j.jar (8861 bytes)
ant-apache-oro.jar (45515 bytes)
ant-apache-regexp.jar (9563 bytes)
ant-apache-resolver.jar (9886 bytes)
ant-apache-xalan2.jar (8097 bytes)
ant-commons-logging.jar (9715 bytes)
ant-commons-net.jar (91451 bytes)
ant-jai.jar (28241 bytes)
ant-javamail.jar (13773 bytes)
ant-jdepend.jar (14024 bytes)
ant-jmf.jar (12541 bytes)
ant-jsch.jar (46176 bytes)
ant-junit.jar (108138 bytes)
ant-junit4.jar (12923 bytes)
ant-launcher.jar (18429 bytes)
ant-netrexx.jar (16215 bytes)
ant-swing.jar (13497 bytes)
ant-testutil.jar (21004 bytes)
ant.jar (1941731 bytes)
-------------------------------------------
USER_HOME/.ant/lib jar listing
-------------------------------------------
user.home: C:\Users\Lodha
No such directory.
-------------------------------------------
Tasks availability
-------------------------------------------
image : Missing dependency javax.media.jai.PlanarImage
sshexec : Missing dependency com.jcraft.jsch.Logger
scp : Missing dependency com.jcraft.jsch.Logger
sshsession : Missing dependency com.jcraft.jsch.Logger
jdepend : Missing dependency jdepend.xmlui.JDepend
A task being missing/unavailable should only matter if you are trying to use it
-------------------------------------------
org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/
-------------------------------------------
XML Parser information
-------------------------------------------
XML Parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
XML Parser Location: unknown
Namespace-aware parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$J
AXPSAXParser
Namespace-aware parser Location: unknown
-------------------------------------------
XSLT Processor information
-------------------------------------------
XSLT Processor : com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
XSLT Processor Location: unknown
-------------------------------------------
System properties
-------------------------------------------
java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : C:\Program Files\Java\jdk1.8.0_11\jre\bin
java.vm.version : 25.11-b03
ant.library.dir : C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib
java.vm.vendor : Oracle Corporation
java.vendor.url : http://java.oracle.com/
path.separator : ;
java.vm.name : Java HotSpot(TM) Client VM
file.encoding.pkg : sun.io
user.script :
user.country : IN
sun.java.launcher : SUN_STANDARD
sun.os.patch.level : Service Pack 1
java.vm.specification.name : Java Virtual Machine Specification
user.dir : C:\hello
java.runtime.version : 1.8.0_11-b12
java.awt.graphicsenv : sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs : C:\Program Files\Java\jdk1.8.0_11\jre\lib\endorsed
os.arch : x86
java.io.tmpdir : C:\Users\Lodha\AppData\Local\Temp\
line.separator :
java.vm.specification.vendor : Oracle Corporation
user.variant :
os.name : Windows 7
ant.home : C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\bin\..
sun.jnu.encoding : Cp1252
java.library.path : C:\Program Files\Java\jdk1.8.0_11\bin;C:\Windows\Sun\Java\bi
n;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.8.0_11;C:\Program Fi
les\Java\jdk1.8.0_11\bin;C:\Program Files\PC Connectivity Solution\;C:\Windows\s
ystem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShel
l\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Python27;C:\Python27\Lib\site-packag
es;C:\Python27\Scripts;C:\Program Files\Google\google_appengine;C:\Program Files
\Intel\OpenCL SDK\2.0\bin\x86;C:\Python27\Lib\site-packages/django;C:\Program Fi
les\QuickTime\QTSystem\;C:\AndroidSdk\sdk\platform-tools;C:\AndroidSdk\sdk\tools
;C:\AndroidSdk\sdk\build-tools;C:\Program Files\nodejs\;C:\Users\Lodha\AppData\R
oaming\npm;C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\bin;C:\Progra
m Files\IDM Computer Solutions\UltraEdit\;C:\Program Files\WinRAR;C:\Program Fil
es\Google\google_appengine\;;.
java.specification.name : Java Platform API Specification
java.class.version : 52.0
sun.management.compiler : HotSpot Client Compiler
os.version : 6.1
user.home : C:\Users\Lodha
user.timezone : Asia/Calcutta
java.awt.printerjob : sun.awt.windows.WPrinterJob
java.specification.version : 1.8
file.encoding : Cp1252
user.name : Lodha
java.class.path : C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\bin\..
\lib\ant-launcher.jar;C:\hello\.\;C:\Program Files\Java\jre8\lib\ext\QTJava.zip;
C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-antlr.jar;C:\Use
rs\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-apache-bcel.jar;C:\Use
rs\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-apache-bsf.jar;C:\User
s\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-apache-log4j.jar;C:\Use
rs\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-apache-oro.jar;C:\User
s\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-apache-regexp.jar;C:\Us
ers\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-apache-resolver.jar;C
:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-apache-xalan2.jar
;C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-commons-logging
.jar;C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-commons-net
.jar;C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-jai.jar;C:\
Users\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-javamail.jar;C:\Use
rs\Lodha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-jdepend.jar;C:\Users\L
odha\AppData\Roaming\npm\node_modules\ant\ant\lib\ant-jmf.jar;C:\Users\Lodha\App
Data\Roaming\npm\node_modules\ant\ant\lib\ant-jsch.jar;C:\Users\Lodha\AppData\Ro
aming\npm\node_modules\ant\ant\lib\ant-junit.jar;C:\Users\Lodha\AppData\Roaming\
npm\node_modules\ant\ant\lib\ant-junit4.jar;C:\Users\Lodha\AppData\Roaming\npm\n
ode_modules\ant\ant\lib\ant-launcher.jar;C:\Users\Lodha\AppData\Roaming\npm\node
_modules\ant\ant\lib\ant-netrexx.jar;C:\Users\Lodha\AppData\Roaming\npm\node_mod
ules\ant\ant\lib\ant-swing.jar;C:\Users\Lodha\AppData\Roaming\npm\node_modules\a
nt\ant\lib\ant-testutil.jar;C:\Users\Lodha\AppData\Roaming\npm\node_modules\ant\
ant\lib\ant.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\tools.jar
java.vm.specification.version : 1.8
sun.arch.data.model : 32
java.home : C:\Program Files\Java\jdk1.8.0_11\jre
sun.java.command : org.apache.tools.ant.launch.Launcher -cp .;C:\Program Files\J
ava\jre8\lib\ext\QTJava.zip -diagnostics
java.specification.vendor : Oracle Corporation
user.language : en
awt.toolkit : sun.awt.windows.WToolkit
java.vm.info : mixed mode, sharing
java.version : 1.8.0_11
java.ext.dirs : C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext;C:\Windows\Sun\Jav
a\lib\ext
sun.boot.class.path : C:\Program Files\Java\jdk1.8.0_11\jre\lib\resources.jar;C:
\Program Files\Java\jdk1.8.0_11\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_11
\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jsse.jar;C:\Pr
ogram Files\Java\jdk1.8.0_11\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_11\j
re\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jfr.jar;C:\Program
Files\Java\jdk1.8.0_11\jre\classes
sun.stderr.encoding : cp437
java.vendor : Oracle Corporation
file.separator : \
java.vendor.url.bug : http://bugreport.sun.com/bugreport/
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeLittle
sun.stdout.encoding : cp437
sun.desktop : windows
sun.cpu.isalist : pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
-------------------------------------------
Temp dir
-------------------------------------------
Temp dir is C:\Users\Lodha\AppData\Local\Temp\
Temp dir is writeable
Temp dir alignment with system clock is 184 ms
-------------------------------------------
Locale information
-------------------------------------------
Timezone India Standard Time offset=19800000
-------------------------------------------
Proxy information
-------------------------------------------
Java1.5+ proxy settings:
Direct connection
C:\hello>
任何人都可以建议我在哪里错了吗?
&安培;如果您需要更多信息,请告诉我。
由于
答案 0 :(得分:0)
您是否添加了环境变量?如果没有,那么添加这些......
您必须放置正确的sdk路径。
答案 1 :(得分:0)
在我的情况下,这是因为我安装了最新版本的Android SDK Build Tools(21)。当我卸载(在Android SDK Manager中)并将版本20作为Android SDK Build-tools的最高安装版本时。它突然起作用了......