Android – Ionic: execution failed for task ‘ processdebugresources’

androidcordovadebuggingionicweb-applications

All the things happened after I made several commands for the ionic App with ngCordova
– ionic start "App Project Name"
– ionic platform add android
– ionic build android

:processDebugResources      Unable to add '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/assets/debug/www/node_modules/try-thread-sleep/node_modules/thread-sleep/node_modules/node-pre-gyp/node_modules/tar-pack/test/fixtures/packed.tar.gz': file already in archive (try '-u'?)

ERROR: unable to process assets while packaging '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_'
ERROR: packaging of '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_' failed
FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':processDebugResources'.

    com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Users/desmondlai/Library/Android/sdk/build-tools/23.0.2/aapt package -f –no-crunch -I /Users/desmondlai/Library/Android/sdk/platforms/android-22/android.jar -M /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/debug -A /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/assets/debug -m -J /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/generated/source/r/debug -F /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_ –debug-mode –custom-package com.ionicframework.starter -0 apk –output-text-symbols /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/symbols/debug
    Error Code:
    1
    Output:
    Unable to add '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/assets/debug/www/node_modules/try-thread-sleep/node_modules/thread-sleep/node_modules/node-pre-gyp/node_modules/tar-pack/test/fixtures/packed.tar.gz': file already in archive (try '-u'?)
    ERROR: unable to process assets while packaging '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_'
    ERROR: packaging of '/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build/intermediates/res/resources-debug.ap_' failed

  • 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: 45.169 secs

/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/desmondlai/Desktop/hairCorner/HairProject/platforms/android/cordova/build: Command failed with exit code 1

Best Solution

Add/remove android didn't fix the problem for me either.

Generating the project resources fixed the issue for me.

ionic resources 
Related Question