输入cordova build命令时出现以下错误。 请帮帮我:以下是我用来设置手机间隙的版本: Cordova版本:4.2.0 Phone Gap版本:4.2.0-0.24.2 JDK:1.8.0_25 Android平台-19 工具:21.1.2
块引用
Error as Follows:
D:\PhonegapWorkspace\hello>cordova build
Running command: D:\PhonegapWorkspace\hello\platforms\android\cordova\build.bat
Buildfile: D:\PhonegapWorkspace\hello\platforms\android\build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 24.0.2
[checkenv] Installed at D:\AndroidSdk\sdk
-setup:
[echo] Project Name: CordovaApp
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
[echo] Resolving Build Target for CordovaApp...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for CordovaApp...
[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 24.0.2
[checkenv] Installed at D:\AndroidSdk\sdk
-setup:
[echo] Project Name: CordovaApp
[gettype] Project Type: Android Library
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
[echo] Resolving Build Target for CordovaApp...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: D:\PhonegapWorkspace\hello\platforms\android\CordovaLib
\ant-build\rsObj
[mkdir] Created dir: D:\PhonegapWorkspace\hello\platforms\android\CordovaLib
\ant-build\rsLibs
[echo] ----------
[echo] Resolving Dependencies for CordovaApp...
[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//Here it is failing to build
D:\AndroidSdk\sdk\tools\ant\build.xml:601: The following error occurred while ex
ecuting this line:
D:\AndroidSdk\sdk\tools\ant\build.xml:720: The following error occurred while ex
ecuting this line:
D:\AndroidSdk\sdk\tools\ant\build.xml:734: Class not found: javac1.8
Total time: 2 seconds
D:\PhonegapWorkspace\hello\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,D:\PhonegapWorkspace
\hello\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-ge
n
ERROR building one of the platforms: Error: D:\PhonegapWorkspace\hello\platforms
\android\cordova\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project
D:\PhonegapWorkspace\hello>
答案 0 :(得分:0)
对于ant版本1.9.x,jdk 8兼容
对于1.9.x以下的蚂蚁verison,你需要jdk 7.
因此,通过ant -verion
检查ant版本并适当添加jdk。