After I installed and configured all the dependencies on the PhoneGap project, I tried to execute
$ Cordova Run Android
command, the following error occurred.
Error:/home/sam/front/redwine/platforms/android/cordova/run:command failed with exit code 8
At Childprocess.whendone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js : 135:23)
At ChildProcess.EventEmitter.emit (events.js:98:17)
At Maybeclose (child_process.js:743:16)
At Process.childprocess._handle.onexit (child_process.js:810:5)
View Rawphonegaperror hosted With❤by GitHub
Cordova build Android or Cordova emulate Android is the same result.
But actually the real problem in the above lines:
[AAPT] (Skipping file '. Jshintrc ' due to android_aapt_ignore pattern '. * ')
[AAPT] (Skipping file '. Bower.json ' due to android_aapt_ignore pattern '. * ')
[AAPT] (Skipping file '. Directory ' due to Android_aapt_ignore pattern '. * ')
[AAPT] Unable to add '/home/sam/front/redwine/platforms/android/assets/www/bower_components/jquery-mobile/node_modules/ Grunt-bowercopy/node_modules/bower/node_modules/semver/semver.browser.js.gz ': File already in archive (try '-u '?)
[AAPT] Error:unable to process assets while packaging '/HOME/SAM/FRONT/REDWINE/PLATFORMS/ANDROID/ANT-BUILD/WINE.AP_ '
[AAPT] Error:packaging of '/HOME/SAM/FRONT/REDWINE/PLATFORMS/ANDROID/ANT-BUILD/WINE.AP_ ' failed
Build FAILED
/home/sam/bin/android-sdk-linux/tools/ant/build.xml:932:the following error occurred while executing this line:
/home/sam/bin/android-sdk-linux/tools/ant/build.xml:950:null returned:1
View RawphonegapError2 hosted With❤by GitHub
This is because there are multiple node_modules directories under the project that are repeatedly packaged with the command failed with exit code 8 issues.
The solution is to modify the Platforms/android/build.xml:
<property name= "Aapt.ignore.assets" value= "<dir>node_*"/>
If you exclude the Node_modules directory, you can perform the Cordova command normally.