Could not find gradle wrapper within Android SDK. Might need to update your Android SDK

varun picture varun · Mar 8, 2017 · Viewed 61.9k times · Source

I am trying to take build in an ionic2 application. I got this error while running ionic build android. The error log is

ANDROID_HOME=/home/varun/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Error: Could not find gradle wrapper within Android SDK. Might need to    update your Android SDK.
Looked here: /home/varun/Android/Sdk/tools/templates/gradle/wrapper

I tried updating the sdk but it was found that the sdk version is latest.

When i looked at the Android/Sdk/tools folder there is no templates directory. I am running on ubuntu 16.04, with cordova version 6.5.0

Answer

jcesarmobile picture jcesarmobile · Mar 20, 2017

Edit:

There has been a newer release of Cordova Android that also fixes some problems with SDK tools 26.x.x

cordova platform update [email protected]

or

cordova platform rm android
cordova platform add [email protected]

Old answer

Google broke Cordova Android 6.1.x and some other frameworks with their latest sdk tools update.

Cordova Android 6.2.1 has been released and it's now compatible with latest Android SDK.

You can update your current incompatible android platform with cordova platform update [email protected]

Or you can remove the existing platform and add the new one (will delete any manual change you did inside yourProject/platforms/android/ folder)

cordova platform rm android cordova platform add [email protected]

You have to specify the version because current CLI installs 6.1.x by default.