我正在尝试构建一个项目,但是当我输入: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)
这个问题有解决办法吗?
编辑
我使用brew来安装Android-SDK并安装了所有可能的构建工具:
我的 Android list 如下所示:
编辑2
根据此处的要求,对 cordova build android --verbose
的响应:http://pastebin.com/rqdkVKYG
最佳答案
我发现了这个错误。
测试时,重新安装 android-sdk 和 ant。我尝试创建一个新项目。比在终端中输入cordova build更完美地构建。之后,我将现有的 WWW 文件夹复制到新项目中。再次输入cordova build
,出现错误。现在我知道错误是在我的 WWW 文件夹中,而不是在项目本身中。扫描我的文件夹时,我注意到一个没有扩展名的文件(隐藏文件)。我删除了该文件并重试。成功!
摘要: 扫描文件夹中是否有没有扩展名的文件,然后删除或移动它们。 Cordova 不喜欢这些。
编辑
如果这不起作用,请尝试:
cordova平台rm android
然后使用以下命令重新安装 android:
cordova平台添加android
现在尝试构建。
关于android - Phonegap 3.3 构建 Android 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21902531/