Could not find gradle wrapper within Android SDK. Might need to update your Android SDK
Solution 1
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.
Solution 2
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:
- 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 (notr25.3.X
). - Unzip this folder. You should end up with a
tools
directory. - Navigate to your
$ANDROID_HOME
directory (~/Library/Android/sdk/
on OS X). - Rename the pre-existing
tools
directory there totools.bak
(e.g.,mv tools tools.bak
) - 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).
Solution 3
This worked for me
cordova platform update [email protected]
Solution 4
There's no need to downgrade Android Tools. On Windows gradle moved from:
C:\Users\you_username\AppData\Local\Android\sdk\tools
to:
C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle\wrapper
So you just need to ajust your path so that it points to the right folder.
Solution 5
I had same problem and I solved it with Carlos Delgado's answer.
- Android Path must be set before all things below.
- Download the latest command line tools (https://developer.android.com/studio/index.html -> very bottom part)
- Unzip -> copy and paste "tools > templates" folder to your project folder (/Libraries/Android/sdk/tools/)
- press option key to see Libraries folder in your Finder
Admin
Updated on April 29, 2020Comments
-
Admin about 4 years
I am trying to take build in an ionic2 application. I got this error while running
ionic build android
. The error log isANDROID_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 notemplates
directory. I am running on ubuntu 16.04, with cordova version6.5.0
-
Sebastián Rojas about 7 yearsDETAILS PLEASE, how do you "Change tools directory to tools_r25.2.3 directory."?
-
cesarvargas about 7 yearsI think he meant to put all the files from r25.3.1 on the previously installed tools folder.
-
Carlos Delgado about 7 yearsIndeed, downloading the latest command line tools and paste its content in the /Android/sdk/tools folder solved the problem ;)
-
shaunc about 7 yearsAFAIKT I was able to get away with just copying the old tools/templates subdirectory into the Android/sdk/tools folder.
-
shareef about 7 yearsYes It WORKED thankks
-
Oleg about 7 yearsThank you! It's really works!
-
dsp_099 about 7 yearsDidn't fix the issue for me.
-
jcesarmobile about 7 years@dsp_099 did you remove android platform first? if you run
cordova platforms
what cordova-android version do you get? -
dsp_099 about 7 yearsI see "Installed platforms: android 6.1.2. See latest question on my profile for more info"
-
jcesarmobile about 7 yearsthen do a
cordova platform rm android
first and thencordova platform add https://github.com/apache/cordova-android
, you should get 6.2.0-dev instead of 6.1.2 -
dsp_099 about 7 yearsStep in the right direction... That helped... sort of. See my question here, seems to be the issue, might give you more intel.
-
Suraj Dubey about 7 yearsit worked, thanks :)
-
Pier about 7 yearsThanks that fixed it for me after updating SDK tools to 25.3.1
-
mentat about 7 yearswhere do we adjust it? in cordova?
-
Playdome.io about 7 yearsI get a warning: cmd: command failed with exit code 1 Can i get rid of it somehow?
-
jcesarmobile about 7 years@Azarus which command?
-
Playdome.io about 7 yearsWhen upgrading the android platform, this seems pretty messed up right now. :/ Spent like 4 hours just setting things up huh
-
Elemental about 7 yearsyou sure you don;t mean @6.2.1?
-
ben_joseph about 7 years@mentat update it in the windows path.
-
Pedro Miguel Pimienta Morales about 7 yearsCan you explain better, excuse me, i don't get the part, tools > templates, i need copy the tools folder into template, o what project you say?
-
Herman Demsong about 7 yearsThanks man, this worked fine for me
-
Adam about 7 yearsYou little beauty.
-
Lifz almost 7 yearsFantastic. Running
cordova platform update android
worked perfectly. It updated to 6.2.3. It must know to look for gradle in the new directory: C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle\wrapper -
ChickenFeet over 6 yearsHow is 6.2.2 a newer release when OP has 6.5.0 ? The two solutions to this problem involve either downgrading Android SDK or Cordova, it doesn't seem like a very sustainable solution - you're going to have to upgrade eventually right?
-
jcesarmobile over 6 years@ChickenFeet No, you are confusing cordova-lib (or Cordova CLI) version with cordova-android version. Cordova CLI 6.5.0 had cordova-android 6.1.1, so, by the time I wrote this, he needed to upgrade the cordova-android version to 6.2.2. Now there is a new Cordova CLI version (7.0.1) that uses cordova-android 6.2.x as default.
-
Mirko over 6 yearsI am sure, that is the version I am using
-
androticus almost 6 yearsThis did not work for me. It still gave the same "can't find gradle wrapper" comment
-
Ananta Prasad over 5 yearscordova platform update [email protected] fixed my issue. thanks bro..:)
-
jcesarmobile over 5 years@LAnantaPrasad at this point you also have 6.4.0 or 7.1.4 available, that also have the problem fixed and are newer
-
Ananta Prasad over 5 years@jcesarmobile thanks
-
Joe over 5 yearsI've been working on this for 3 days. You save my life. Thanks.
-
mahendren about 5 yearsThis is working for me thanks dude......