I'm currently building my first android app using cordova/phonegap. I've scaffolded out a project as you would normally and then inside the android projects' assets/ folder I've added an app/ directory and a gruntfile that compiles everything into the www/ directory.
When I come to run/debug the project in the emulator, ADT throws out a lot of console errors (below are the last 5 lines)
[2014-03-08 22:54:09 - mentalcombat] (skipping file '.npmignore' due to ANDROID_AAPT_IGNORE pattern '.*')
[2014-03-08 22:54:09 - mentalcombat] (skipping file '.npmignore' due to ANDROID_AAPT_IGNORE pattern '.*')
[2014-03-08 22:54:09 - mentalcombat] (skipping file '.travis.yml' due to ANDROID_AAPT_IGNORE pattern '.*')
[2014-03-08 22:54:09 - mentalcombat] Unable to add '/Users/leaky/sites/Android/mentalcombat/assets/node_modules/bower/node_modules/semver/semver.browser.js.gz': file already in archive (try '-u'?)
[2014-03-08 22:54:09 - mentalcombat] ERROR: unable to process assets while packaging '/Users/leaky/sites/Android/mentalcombat/bin/resources.ap_'
[2014-03-08 22:54:09 - mentalcombat] ERROR: packaging of '/Users/leaky/sites/Android/mentalcombat/bin/resources.ap_' failed
When I delete the node_modules folder inside assets/ then the project will run/debug fine in the emulator.
Any ideas what could be causing this issue or does anybody have a fix/workaround?
Had the exact same problem. Exclude node modules from platforms/android/build.xml:
<property name="aapt.ignore.assets" value="<dir>node_*" />
Source:
You should't modify build.xml for it is generated everytime.
With the help of this article, I found that you can create/edit the platform/android/ant.properties
and add the following line to it:
aapt.ignore.assets=!*.map:!thumbs.db:!.git:.*:*~:node_*
I added the node_* part in order to ignore node related files. The build is fine now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.