I'm using bower to download and manage all the polymer components. However after adding the "bower_components" folder, Cordova can no longer build successfully.
:processDebugResources
Unable to add 'C:\...\platforms\android\build\intermediates\assets\debug\www\bower_components\web-animations-js\web-animations.min.js.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging 'C:\...\platforms\android\build\intermediates\res\resources-debug.ap_'
ERROR: packaging of 'C:\...\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'.
.......
Error Code:
1
Output:
Unable to add 'C:\...\platforms\android\build\intermediates\assets\debug\www\bower_components\web-animations-js\web-animations.min.js.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging 'C:\...\platforms\android\build\intermediates\res\resources-debug.ap_'
ERROR: packaging of 'C:\...\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: 13.038 secs
It seems like it's because of the .gz file in /web-animations-js.
Anyway, there are also a lot of files and folders that should be removed, such as those "test" and "demo" folders, which is included when I download the components with bower.
How should I solve this problem?
I am not sure why the build of Cordova is failing, but answering your second question regarding the removal of test/demo files, you could make use of the Cordova hooks.
We are using Ionic Framework on top of Cordova and there is a interesting article here about some Cordova hooks.
So one of the hooks we are using is a file called
030_clean_dev_files_from_platforms.jslocated in thehooks/after_preparedirectory and contains the following: