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

Error Message:

ANDROID_HOME=/Users/vikin/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /Users/vikin/Library/Android/sdk/tools/templates/gradle/wrapper

ionic cli version

2.2.1

Android SDK


The same happens to me. Compiliation and emulation works on Android studio, but ends with the error when using cordova run android or ionic emulate android. I use example project. Before I had an error about Gradle version (so I changed it to 3.3):

Error: /Users/daniel/Applications/Angular2/myApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/Users/daniel/Applications/Angular2/myApp/platforms/android/build.gradle’ line: 20
  • What went wrong:
    A problem occurred evaluating root project ‘android’.

Failed to apply plugin [id ‘com.android.application’]
Minimum supported Gradle version is 3.3. Current version is 2.14.1. If using the gradle wrapper, try editing the distributionUrl in /Users/daniel/Applications/Angular2/myApp/gradle/wrapper/gradle-wrapper.properties to gradle-3.3-all.zip

A lot of us had this. Check an earlier post out for the answer:

@jdm79, I have already tried this. It just changed the error to:

Error: /Users/danielkucal/Applications/Angular2/myApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/Users/daniel/Applications/Angular2/myApp/platforms/android/build.gradle’ line: 20
  • What went wrong:
    A problem occurred evaluating root project ‘android’.

Failed to apply plugin [id ‘com.android.application’]
Gradle version 2.2 is required. Current version is 3.3. If using the gradle wrapper, try editing the distributionUrl in /Users/daniel/Applications/Angular2/myApp/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip

But then I changed gradle version in platform/android/build.gradle and platform/android/cordova/lib/builders/GradleBuilder.js (like described here) and it finally works! Thanks.

@jdm79 @DanielKucal @lilMarc051372 @mi3infomaze @francoisP
Thank you for your, problem has been resolved, download the android tools, replace the android studio tool in the directory!
I use Mac in work;:slight_smile:

2 Likes

If you are in Ubuntu or Debian, download https://dl.google.com/android/repository/tools_r25.2.3-linux.zip and replace the tools folder content with this. is working for me. good luck!

4 Likes

Sorry, but there is NO answer for Win 10 / VS 2015. Any idea where can you give the changed path for android SDK?

I don’t have Windows, so haven’t tested this solution, but it seems to have positive feedback

i’m working!! Thank you!!

Hi!, hi solve the problem installing “Gradle” in my computer from the oficial website.
Add the /bin folder to the Environment variable PATH, check it typing “gradle -v” at your bash.
Then create a folder oin your skd/tools call it “/templates/gradle/wrapper” then execute inside “/wrapper” the system bash and type “gradle wrapper”. When the process finish, all wheel ok!

2 Likes

Take a look at:

https://cordova.apache.org/announcements/2017/04/05/android-release.html

EDIT: Since Cordova 7 the issue with the new SDK tools should be resolved, rendering the above unnecessary

1 Like

This was the solution for me. Thank you @brickolicious

1 Like

really like solution of "cserenissimo"
to recap, make sure ‘locally installed’ “gradle” (at least 3.2?) is on your $PATH
$ cd $ANDROID_HOME/tools
$ mkdir -p templates/gradle/wrapper
$ cd templates/gradle/wrapper
$ gradle wrapper   // this installs the needed ‘stuff’
…
$ cd ${myIonicProjectHome}
$ ionic run android -lc   // livereload + console-log

Its already fixed with Cordova 7.0.0
Just upgrade your cordova to latest version:

  1. npm install -g cordova
  2. cd {myIonicProjectHome}
  3. cordova platform update

https://cordova.apache.org/news/2017/05/04/cordova-7.html

3 Likes

Thank you @vikin

I solved my problem !

download the android tools, replace the android studio tool in the directory!

Thank you nonsene. You saved my day. Simple as that.

can you explain a little bit more ? where is android tools ?

@techsnake, If you update to latest Android version, you will be forced to install Android Studio, Tools is within the start menu (Configure > Settings > System Settings > Android SDK) and inside that page (Tab SDK Tools). Screenie:

Can you eplain this a little bit more ? where to download where is th android tool directory . I am really fed up and tired to solve this problem 3 days

Google it, download android studio. It changed name a few monthes ago (and Android Tools are now part of Android Studio). For a clean update, uninstall your Android tools setup, and then install Android studio. For the files location, look at my screenshot above, taken from Android Studio.