当我在cmd中做cordova build android时,它给出了一个错误:
输出为:
D:Projectsmyprojectfortest-clone>cordova build android
Running command: D:Projectsmyprojectfortest-cloneplatformsandroidcordovabuild.b
at
Buildfile: D:Projectsmyprojectfortest-cloneplatformsandroidbuild.xml
BUILD FAILED
D:Projectsmyprojectfortest-cloneplatformsandroidbuild.xml:90: Cannot find D:nb1
8908Android22SDKadt-bundle-windows-x86_64-20130917sdktoolsantbuild.xml imp
orted from D:Projectsmyprojectfortest-cloneplatformsandroidbuild.xml
Total time: 0 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,D:Projectsmysafari
com-cloneplatformsandroidbuild.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant
-gen
Error: D:Projectsmyprojectfortest-cloneplatformsandroidcordovabuild.bat: Command failed with exit code 2
at ChildProcess.whenDone (C:UsersMyUserAppDataRoamingnpmnode_modules
cordovasrcsuperspawn.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)
My环境变量:
ANDROID_HOME C:Usersnb14696AppDataLocalAndroidandroid-sdktools
ANDROID_PLATFORM_TOOLS C:Usersnb14696AppDataLocalAndroidandroid-sdkplatform-tools
ANDROID_PLATFORMS C:Usersnb14696AppDataLocalAndroidandroid-sdkplatforms
Path C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program Files (x86)IntelOpenCL SDK2.0binx86;C:Program Files (x86)IntelOpenCL SDK2.0binx64;C:Program Files (x86)IntelServicesIPT;C:Program FilesWIDCOMMBluetooth Software;C:Program FilesWIDCOMMBluetooth Softwaresyswow64;C:Program Files (x86)Microsoft ASP.NETASP.NET Web Pagesv1.0;C:Program FilesMicrosoft SQL Server110ToolsBinn;C:Program Files (x86)Microsoft Team Foundation Server 2012 Power Tools;C:Program Files (x86)Microsoft Team Foundation Server 2012 Power ToolsBest Practices Analyzer;C:Program Files (x86)Windows Kits8.1Windows Performance Toolkit;C:Program Filesnodejs;C:Program Files (x86)Javajdk1.7.0_55bin;%ANDROID_HOME%;%ANT_HOME%bin;C:Program Files (x86)Microsoft SDKsTypeScript1.0;C:Program FilesMicrosoft SQL Server120ToolsBinn;C:Program FilesMicrosoftWeb Platform Installer;C:Program FilesTortoiseHg;C:Program FilesMercurial;C:apache-ant-1.9.3bin;%ANDROID_PLATFORM_TOOLS%;%ANDROID_PLATFORMS%;
我已经安装了Android SDK版本2.2和4.4.2,有什么问题吗?
我知道这有点晚了,但我希望它能帮助别人。首先,我想纠正我在你的路径中发现的一些错误,
ANDROID_HOME C:Usersnb14696AppDataLocalAndroid android sdk工具
应该是
ANDROID_HOME C:Usersnb14696AppDataLocalAndroid android sdk
虽然你必须有
%ANDROID_HOME%/tools和%ANDROID_HOME%/platform-tools
必须在您的路径中可用。一旦你解决了,执行
android list target
确认您有所需的目标。然后再尝试构建命令
我也有类似的问题。
问题是Ant版本与我的Java版本不兼容。
我的Ant版本是1.8.4。最初,我使用的是JDK 8——它只支持Ant 1.9;更大的
因此,我卸载了JDK8并恢复到JDK7
是的,我本来可以更新Ant本身的。这也是一种选择。但是,我特别需要Ant1.8