2

I ported an existing AngularJS project to Ionic, but got this build error from "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

I saw another post on multiple plug-ins depending on the same module, and followed suggestion to add a file named build-extras.gradle with this:

android {
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}

Still does't work.

I also tried this without success:

$ cordova platform rm android
$ cordova platform add android

This post doesn't help either.

I can build another simple project without problem. I was wondering if any of my node modules are conflicting with Ionic on dependency:

<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>

How to fix this? Any help is appreciated.

Community
  • 1
  • 1
gfc
  • 57
  • 6
  • You can try ant instead :) cordova build android -- --ant – Kirill Chatrov Mar 02 '16 at 21:01
  • Thanks. I got this error, but not sure how to fix it.[aapt] (skipping dir '.bin' due to ANDROID_AAPT_IGNORE pattern '.*') [aapt] (skipping dir '_' due to ANDROID_AAPT_IGNORE pattern '_*') [aapt] Unable to add '/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': file already in archive (try '-u'?) [aapt] ERROR: unable to process assets while packaging ... – gfc Mar 04 '16 at 04:16

4 Answers4

1

I solved the issue by deleting the "node_modules" folder in the www directory.

I stopped searching further in the fsevents directory (www/node_modules/grunt-html2js/node_modules/chokidarnode_modules/fsevents). There were too many folders.

Stefan Rein
  • 8,084
  • 3
  • 37
  • 37
0

Try to exclude node modules from platforms/android/build.xml:

<property name="aapt.ignore.assets" value="&lt;dir&gt;node_*" />
Kirill Chatrov
  • 822
  • 6
  • 11
  • Thank you, Kirill. I still got the same error after adding this line. – gfc Mar 04 '16 at 20:09
  • Could you confirm that your Android SDK is up to date? (Platform-tools, SDK Tools, Build-tools and SDK platform for API 23). – Kirill Chatrov Mar 04 '16 at 20:40
  • According to SDK Manager, I have SDK Tools 24.4.1, platform-tools 23.1, build-tools 23.0.2, and SDK platform API 23 rev 2. They also show up during the build. – gfc Mar 04 '16 at 23:50
0

Assuming that you have API 21, I'd try changing the version of buildTools to:

buildToolsVersion "21.0.2"

in your build.gradle

Kirill Chatrov
  • 822
  • 6
  • 11
0

I was having the same issue and found what was wrong by executing

./platform/android/gradlew --info build clean
Diego Mello
  • 5,220
  • 3
  • 17
  • 21