【问题标题】:Ionic build error on processDebugResources with Gradle使用 Gradle 在 processDebugResources 上的离子构建错误
【发布时间】:2016-06-15 20:57:26
【问题描述】:

我将一个现有的 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>

如何解决这个问题?任何帮助表示赞赏。

【问题讨论】:

  • 你可以试试 ant :) cordova build android -- --ant
  • 谢谢。我收到了这个错误,但不知道如何修复它。[aapt](由于 ANDROID_AAPT_IGNORE 模式'.*'而跳过目录'.bin')[aapt](由于 ANDROID_AAPT_IGNORE 模式而跳过目录'' i>*') [aapt] 无法添加'/Users/Frank/Documents/Code/MyAppClientWeb/MyAppWeb/platforms/android/assets/www/node_modules/karma/node_modules/chokidar/node_modules/fsevents/node_modules/node-pre -gyp/node_modules/tar-pack/test/fixtures/packed.tar.gz':文件已经在存档中(尝试'-u'?)[aapt] 错误:打包时无法处理资产...

标签: android angularjs cordova gradle ionic-framework


【解决方案1】:

尝试从platforms/android/build.xml中排除节点模块:

<property name="aapt.ignore.assets" value="&lt;dir&gt;node_*" />

【讨论】:

  • 谢谢你,基里尔。添加此行后我仍然遇到相同的错误。
  • 您能否确认您的 Android SDK 是最新的? (API 23 的平台工具、SDK 工具、构建工具和 SDK 平台)。
  • 根据 SDK Manager,我有 SDK Tools 24.4.1、platform-tools 23.1、build-tools 23.0.2 和 SDK platform API 23 rev 2。它们也在构建过程中出现。
【解决方案2】:

假设您有 API 21,我会尝试将 buildTools 的版本更改为:

buildToolsVersion "21.0.2"

在你的build.gradle

【讨论】:

  • 抱歉,还是没有运气。
【解决方案3】:

我通过 www 目录中的deleting the "node_modules" folder 解决了这个问题。

我停止在 fsevents 目录 (www/node_modules/grunt-html2js/node_modules/chokidarnode_modules/fsevents) 中进一步搜索。文件夹太多。

【讨论】:

    【解决方案4】:

    我遇到了同样的问题,通过执行发现问题所在

    ./platform/android/gradlew --info build clean
    

    【讨论】:

      猜你喜欢
      • 2017-05-05
      • 2018-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-16
      • 2017-02-05
      • 1970-01-01
      相关资源
      最近更新 更多