I keep getting the following build exception when I run
cordova run android --verbose
You can try out the following to resolve the issue,
On Windows, Change File -> Settings -> Builds,Execution,Deployment -> Build Tools -> Gradle -> Gradle home
path
On Mac OS, Change Android Studio -> Preferences -> Builds,Execution,Deployment -> Build Tools -> Gradle -> Gradle home
path
Else use default gradle wrapper and edit Project\gradle\wrapper\gradle-wrapper.properties file's distributionUrl
like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
This was happening to me because I wasn't building with the latest version of cordova-android. so:
cordova platform rm android
cordova platform add android@latest
Take not of the @latest
directive.
Also be sure to update download the latest version of gradle and include it in the appropriate directory, as pointed out in the other answers.