Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assets and node_modules (Phonegap/Cordova)

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?

like image 669
leaksterrr Avatar asked Dec 19 '25 01:12

leaksterrr


1 Answers

Had the exact same problem. Exclude node modules from platforms/android/build.xml:

<property name="aapt.ignore.assets" value="&lt;dir&gt;node_*" />

Source:

http://www.zfanw.com/blog/phonegap-error-exit-code-8.html

like image 152
lhendricks92 Avatar answered Dec 20 '25 17:12

lhendricks92



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!