简体   繁体   English

Phonegap 3.3构建Android失败

[英]Phonegap 3.3 Build Android Failed

I'm trying to build a project but when I type: cordova build android the following error occurred: 我正在尝试构建一个项目,但是当我键入: cordova build android ,发生以下错误:

Generating config.xml from defaults
for platform "android"
Preparing android project
Compiling app on platform "android"
via command "../platforms/android/cordova/build"
Error: An error occurred
while building the android project.Error executing "ant debug -f "../platforms/android/build.xml"":BUILD FAILED /usr/local/Cellar/android-sdk/22.3/tools/ant/build.xml:932:The following error occurred
while executing this line: /usr/local/Cellar/android-sdk/22.3/tools/ant/build.xml:950:null returned: 1

Total time: 18 seconds


at ChildProcess. < anonymous > (/usr/local/lib/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)

Is there a fix for this problem? 有解决此问题的方法吗?


EDIT 编辑

I used brew to install Android-SDK and installed all possible build-tools: 我使用brew安装Android-SDK并安装了所有可能的构建工具: Android-SDK位置

And my android manifest looks like: 我的Android清单看起来像: Android清单

EDIT2 编辑2

As requested here is the responce for cordova build android --verbose : http://pastebin.com/rqdkVKYG 根据要求,这里是cordova build android --verbose的响应: http : //pastebin.com/rqdkVKYG

I found the bug. 我发现了错误。

While testing, reinstalling android-sdk and ant. 在测试时,重新安装android-sdk和ant。 I tried to create a new project. 我试图创建一个新项目。 Than typed in the terminal cordova build and it build flawlessly. 比键入终端cordova build ,它完美地构建。 After this I copied my existing WWW folder in to the new project. 之后,我将现有的WWW文件夹复制到了新项目中。 Typed cordova build again, it gave an error. 再次键入cordova build ,它给出了一个错误。 Now I knew that the bug was in my WWW folder and not in the project itself. 现在,我知道该错误在我的WWW文件夹中,而不在项目本身中。 Scanning my folders I noticed a file with no extension(hidden files). 扫描文件夹时,我发现没有扩展名的文件(隐藏文件)。 I deleted the file and tried again. 我删除了文件,然后重试。 Success! 成功!

SUMMARY: Scan your folders for files without extensions and delete or move them. 摘要:扫描文件夹中没有扩展名的文件,然后删除或移动它们。 Cordova doesn't like those. 科尔多瓦不喜欢那些。


EDIT 编辑

If this doesn't work try: 如果这不起作用,请尝试:

cordova platform rm android

then reinstall android using : 然后使用重新安装android:

cordova platform add android

Now try to build. 现在尝试构建。

尝试运行命令$home/.cordova/lib/android/cordova/3.3.0/bin/check_reqs来检查是否已安装android所需的所有组件。

¿Did you add to windows path the sdk? ¿您是否已将SDK添加到Windows路径?

You can also try: 您也可以尝试:

  • cordova platform add android 科尔多瓦平台添加Android
  • cordova build 科尔多瓦建立

try ant -v in your terminal and make sure it's above 1.8. 在您的终端上尝试使用ant -v并确保其高于1.8。 Cordova requires that. 科尔多瓦要求。 Also check path is given correct for Ant, Android-SDK/tools, and Android-SDK/platformtools 还检查了Ant,Android-SDK / tools和Android-SDK / platformtools的正确路径

To debug exact issue try $Cordova build android --verbose 要调试确切的问题,请尝试$Cordova build android --verbose

Let me know. 让我知道。

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

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