我正在开发一个适用于 android 和 ios 的混合移动应用程序,其中包含 cordova、AngularJS 和 AngularMaterial Design。我使用 npm、bower 和 grund 来管理和运行构建任务。我可以构建 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.
我的环境:
- [email protected]
- node_modules 节点包
- bower_components 与 Bowers 的依赖关系
- Angularjs 和 Angular Material 设计
感谢任何帮助。
ps:我跑
cordova platform add android
cordova build android
我什至尝试删除/添加 Android,但仍然没有成功。
一个有趣的观察,如果我使用一个空白项目,那么它将为两个平台成功构建
谢谢
最佳答案
我发现了这个问题。我在 Cordova 项目的 www 中有 node_moudles 和 Bower_components 。将我的 NodeJS 依赖项从 www 移走并删除 Bower_Components 文件夹并再次尝试 Bower 安装后,它可以工作。
我真的不明白cordova构建android在幕后运行时会导致在www.node_modules中出现错误。
仅供引用,我只是使用 npm 来管理我的开发的依赖关系(karma、grunt、httpserver,...)。最好将其从 www 中移走。
关于Cordova构建android错误任务 ':processDebugResources'执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36258106/