Cordova 构建 android 错误任务“:processDebugResources”执行失败

Cordova build android error Execution failed for task ':processDebugResources'

我正在使用 cordova、angularjs 和 angularmaterial design 为 android 和 ios 开发混合移动应用程序。我使用 npm、bower 和 g运行d 来管理和 运行 构建任务。我可以构建 ios 但不能构建 android 并出现错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: 
Process 'command '/xxx/android-sdk/build-tools/23.0.3/aapt'' 
finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 0.919 secs
Error: Error code 1 for command: /xxx/platforms/android/gradlew with args: cdvBuildDebug,-b,/xxx/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true.

我的环境:

感谢任何帮助。

ps: 我运行

cordova platform add android
cordova build android

我什至尝试 remove/add android 但仍然没有成功。

一个有趣的观察,如果我使用一个空白项目那么它将为两个平台成功构建

谢谢

我发现了问题。我在 Cordova 项目的 www 中有 node_moudles 和 bower_components。从 www 移动我的 nodejs 依赖项并删除 bower_components 文件夹并再次尝试安装 bower 后,它可以正常工作。

我真的不明白 cordova 在幕后构建 android 运行 是什么在 www 中包含 node_modules 时导致错误。

仅供参考,我只是使用 npm 来管理我的开发依赖项(karma、grunt、httpserver 等)。最好从 www.

尝试将 phonegap (xmlns:gap="http://phonegap.com/ns/1.0") 的 xml 命名空间添加到 config.xml

对我来说,问题是由 bower_components 引起的。我使用 "bower link" 命令来引用本地 Bower 包,这样我就可以同时处理它。但是当我尝试构建到 Android 时,构建失败并显示相同的错误消息。 使用

bower unlink YOUR_PACKAGE_NAME

(或只是删除 'bower_components' 目录)然后通过

重新安装软件包

bower install

已解决此问题。