I am using Mac Yosemite. Getting the following failure on running a build for android platform :
FAILURE: Build failed with an exception.
* What went wrong:
But in my case, It resolved by removing the below line
<gap:plugin name="nl.x-services.plugins.socialsharing" />
from my config.xml file
Yes, Build successful after removing the below line
<gap:plugin name="nl.x-services.plugins.socialsharing" />
from config.xml
For me, turned out to be the long name length of some of the images I had inside the assets folder.
Just be aware. After deleting those images I was still getting the same error. The reason being that the images persisted inside the www
folder. Deleted that folder and worked!
Like some others, my error was caused by some terrible hidden files that were tripping gradle up.
In my case it was the special "Icon?" file that OSX creates inside of any folder that has a custom icon (such as Google Drive, Dropbox, etc). The file is actually named "Icon\r", and I believe java/gradle is tripping up over the "\r" (or any unexpected, unescaped character).
Solution was to nuke all the spurious "Icon?" files from my project directory:
# note that this is the syntax for zsh.
# If you're using bash test out the pattern first before including '-delete'
find ~/code/myproject/ -name Icon$'\r' -delete
To get more info to debug this go in to the ./platforms/android/
folder and run:
Mac users:
gradlew --info build clean
Linux users (thanks Pierre):
./gradlew --info build clean
Windows users:
gradlew.bat --info build clean
This gives you a lot more detail.
My issue was solved this way, found some files that where incorrectly dropped into the project folder with spaces in the file names.
This issue gets resolved by adding xml namespace for phonegap (xmlns:gap="http://phonegap.com/ns/1.0") to config.xml
After adding :
<widget id="com.ionicframework.yourpackagename"
version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:gap="http://phonegap.com/ns/1.0">
Hope it helps someone facing similar issue.