我刚刚下载了Cordova,以及Android和Windows Phone的所有要求。我可以成功构建WP8图像并将其发送到我的8X,但是,我似乎无法构建Android图像。
当我执行cordova build android
时,我收到以下错误:
从平台“android”的默认值生成config.xml 准备android项目 通过命令“cmd”/ c Y:\ mobile \ platforms \ android \ cordova \ build
在平台“android”上编译应用程序C:\Users\x\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:126
throw e;
^
Error: An error occurred while building the android project.
at ChildProcess.<anonymous> (C:\Users\x\AppData\Roaming\npm\node_modules\cordova\src\compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
当我手动启动构建命令时,出现以下错误:
Error executing "ant debug -f "Y:\mobile\platforms\android\build.xml"":
BUILD FAILED
C:\Development\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:962: The following error occurred while executing this line:
C:\Development\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:973: The following error occurred while executing this line:
C:\Development\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:313: com.android.sdklib.build.ApkCreationException: Y:\mobile\platforms\android\bin\rs
Libs does not exist
at com.android.sdklib.build.ApkBuilder.getNativeFiles(ApkBuilder.java:742)
at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:303)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
似乎cordova-3.3.0.jar文件没有编译,不应该自动编译?有什么我想念的吗?
答案 0 :(得分:0)
Ant可能是一个错误。我有这个错误,因为我忘了更改环境变量路径。
我添加的路径错误(您需要指定此文件夹:“way \ to \ apache-ant-1.9.3 \ bin”)。我刚刚改变了它现在有效。
(如果不是这样,它可以是其他路径环境变量,例如node,或者你的java sdk或android sdk)
希望它可以帮助别人。
答案 1 :(得分:0)
我刚刚删除了整个Android项目,重新编译了CordovaLibs并重新编译了Android项目。好像已经修好了。
答案 2 :(得分:-2)
尝试命令
cordova platform rm android
cordova platform add android
cordova build android