我将一个现有的 AngularJS 项目移植到 Ionic,但是从“ionic run Android”得到了这个构建错误:
...
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources FAILED
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 '/Users/Frank/Library/Android/sdk/build-tools/23.0.2/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: 6.07 secs
ERROR running one or more of the platforms: Error code 1 for command: /Users/Frank/Documents/Code/MyAppClientWeb/MyApp/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/Frank/Documents/Code/MyAppClientWeb/MyApp/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to run this project
我看到另一篇关于依赖于同一个模块的多个插件的帖子,并按照建议添加一个名为 build-extras.gradle 的文件:
android {
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
还是不行。
我也试过没有成功:
$ cordova platform rm android
$ cordova platform add android
这个 post 也没有帮助。
我可以毫无问题地构建另一个简单的项目。我想知道我的任何节点模块是否与 Ionic 的依赖冲突:
<script type="text/javascript" src="node_modules/angular-aria/angular-aria.js"></script>
<script type="text/javascript" src="node_modules/angular-material/angular-material.js"></script>
<script type="text/javascript" src="node_modules/angular-ui-router/build/angular-ui-router.js"></script>
<script type="text/javascript" src="node_modules/closure-library/closure/goog/base.js"></script>
<script type="text/javascript" src="node_modules/angular-google-maps/node_modules/lodash/index.js"></script>
<script type="text/javascript" src="node_modules/angular-google-maps/node_modules/angular-simple-logger/dist/index.js"></script>
<script type="text/javascript" src="node_modules/angular-google-maps/dist/angular-google-maps.js"></script>
<script type="text/javascript" src="SimeonC-md-date-time-3395233/dist/md-date-time.js"></script>
<script type="text/javascript" src="bower_components/angular-rateit/dist/ng-rateit.js"></script>
如何解决这个问题?感谢您的帮助。
最佳答案
我通过删除 www 目录中的“node_modules”文件夹
解决了这个问题。
我停止在 fsevents 目录中进一步搜索 (www/node_modules/grunt-html2js/node_modules/chokidarnode_modules/fsevents)。文件夹太多。
关于android - 使用 Gradle 在 processDebugResources 上 ionic 构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35756831/