Android Build failed - Ionic / Cordova - Unable to add asset file - file already in archive

Got this error:

    Unable to add '/Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/assets/debug/www/lib/angular-localization/angular-localization.min.js.gz': file already in archive (try '-u'?)
    ERROR: unable to process assets while packaging '/Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/res/resources-debug.ap_'
    ERROR: packaging of '/Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/res/resources-debug.ap_' failed
    :processDebugResources 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/MRW/Library/Android/sdk/build-tools/23.0.1/aapt package -f --no-crunch -I /Users/MRW/Library/Android/sdk/platforms/android-22/android.jar -M /Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/res/debug -A /Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/assets/debug -m -J /Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/generated/source/r/debug -F /Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.ionicframework.gtrackerde947201 -0 apk --output-text-symbols /Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/symbols/debug
      Error Code:
      	1
      Output:
      	      Unable to add '/Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/assets/debug/www/lib/angular-localization/angular-localization.min.js.gz': file already in archive (try '-u'?)
      	ERROR: unable to process assets while packaging '/Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/build/intermediates/res/resources-debug.ap_'
      	ERROR: packaging of '/Users/MRW/Desktop/Work/niv/extern/mobile-app/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: 19.601 secs
    
    /Users/MRW/Desktop/Work/niv/extern/mobile-app/platforms/android/cordova/node_modules/q/q.js:126

Can someone please help me? i tried:

  • reinstall android sdk
  • install it with android studio
  • reinstall cordova
  • reinstall ionic
  • clear platform folder of project
  • and ofc…tun with -u …

:frowning: i cant find an answer with google…

got same issue on windows…

same here!

The problem Its related to file extension .gz ( Still I dont know why)

https://osvaldojiang.com/p/137

@Naxmeify
Here How i solve it.