For anyone  having this issue, below worked for me:

    cordova platform update android@latest

then build and it will download the newest gradle version and should work

## codova - android update 
npm install -g cordova
cordova platform update android

My Android studio updated  and then i'm getting that error,and to solve this replace the tools folder with the latest one wouldn't work for me.

npm update -g cordova did the trick for me.

Then I removed the platform and added it again.

ionic platform remove android

ionic platform add android

This works for me in Ionic. I am surecordova platform remove/add android will do the same stuff. Not tested though.

for existing ionic project ,below worked for me

npm install -g cordova
cd <project_dir>
cordova platform update android

If you Android Studio already installed, try to copy the templates directory of Android Studio

C:\Program Files\Android\Android Studio\plugins\android\lib\templates

to your android sdk tools directory:

C:\Android\sdk\tools

had a similar problem with Android Studio running on a Mac.

I fixed it with the following commands:

cp -r /Applications/Android\ Studio.app/Contents/plugins/android/lib/templates ~/Library/Android/sdk/tools
chmod a+x ~/Library/Android/sdk/tools/templates/gradle/wrapper/gradlew

In mac

  1. Copied templates folder from /Applications/Android Studio.app/Contents/plugins/android/lib to <ANDROID_HOME>/tools
  2. chmod -R 777 <ANDROID_HOME>

I resolved by this by replacing the tools folder in my Android SDK with an older version of the SDK tools (r25.2.3). Follow these steps to do the same:

  1. Navigate to https://developer.android.com/studio/index.html, click "Download Options", scroll down, and download the command line tools package for your platform, ensuring that you get a version in the r25.2.X series (not r25.3.X).
  2. Unzip this folder. You should end up with a tools directory.
  3. Navigate to your $ANDROID_HOME directory (~/Library/Android/sdk/ on OS X).
  4. Rename the pre-existing tools directory there to tools.bak (e.g., mv tools tools.bak)
  5. Move the tools directory you just downloaded into the SDK folder (e.g., mv ~/Downloads/tools/ .)

A new major version of the SDK tools was just released, which appears to be causing some issues with Ionic (see the press release here: http://tools.android.com/recent/androidsdktoolsrevision2530feb2017).

  • Download tools_r25.2.3-windows.zip from Android Downloads.

  • Extracted zip on desktop

  • Replaced C:\Users\username\AppData\Local\Android\sdk\tools with extracted sub-folder tools/

  • In project folder:

    $ cordova platforms remove android
    $ cordova platforms add android

You may also need to force remove the node_modules in android. Hopefully this helps.