When I run ionic build android command in root of ionic project, I am getting this error:
FAILURE: Build failed with an exception.
This is very irritating error and i wasted my almost 9 hours to solve this.
Steps to solve:
Notice **ANDROID_HOME** while you run **ionic cordova build android** . command i. for example in my case it was pointing to some other android sdk which i uninstalled and then it started pointing to right sdk.
**In my case i uninstalled :**
brew cask uninstall android-sdk
brew cask uninstall android-platform-tool
then i ran **ionic cordova build android**
> cordova build android
ANDROID_HOME=/Users/anand/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
Then it might say lineces not accepted then run below command :
cd /Users/Android/sdk/tools/bin/
then run ./sdkmanager --licenses
accepts all with y option
Then it might say unable to download jars then go to platform android and build.gradle
and search for buildscript and inside that reverse the order
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
Thats it . Enjoy huh