Error: Could not find gradle wrapper within Android SDK

When running ionic build android

ANDROID_HOME=/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home

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

I tried updating sdk using android update sdk -u
but still same error.

3 Likes

same issue here! help please

ANDROID_HOME=/Users/xxx/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/xxx/Library/Android/sdk/tools/templates/gradle/wrapper

I tried to update the android sdk manually but the problem still exists.
Any help with this problem ?

1 Like

My app is running fine on iOS and I just installed Android SDK etc to build on Android but now I’m having this error as well. My /Library/Android/sdk/tools/ doesn’t have a templates folder. Something wrong with my installations?

It seems to be related to a change from Google to the Android SDK.

Cf: http://tools.android.com/recent/androidsdktoolsrevision2530feb2017
"Obsolete/deprecated tools have been removed: […] Project and activity templates"

I guess we have to wait for a fix from the Ionic team :frowning: (I’ve filled a bug report: https://github.com/driftyco/ionic/issues/10604)

Workaround is to install old version of SDK tools. It cannot be done with SDK manager because the old versions are not listed there.

See http://stackoverflow.com/questions/26016770/how-to-install-old-version-of-android-build-tools-from-command-line

  1. First download the latest “pre 25.3.0” version. In my case (on MacOS): https://dl.google.com/android/repository/tools_r25.2.5-macosx.zip
  2. Then remove Android SDK Tools with SDK Manager
  3. Finally unzip the downloaded file in your SDK folder (/Users/clementcontet/Library/Android/sdk/ on my computer).
11 Likes

Where do you find a list of older tools? I need one for PC. Only thing I could find was a lot about how to do it in Android Studio which does not work.

EDIT: Ok just use “windows” in place of “macosx” to get the windows version.

Thanks! This fixed my issue. :slight_smile:

I just changed ANDROID_HOME from
C:\Users\<NAME>\AppData\Local\Android\Sdk
to
C:\Users\<NAME>\AppData\Local\Android\Sdk\tools\Sdk
and that worked

Thanks, this fixed the issue on my win7x64 pc.

Thanks! My android build is now happily proceeding. Win10 x64

I was able to successfully do a build. Although I did have to deal with this licensing issue:

Nice :wink: WHERE in VS2015 you can do this change?

0
down vote
None of the solutions worked for me as of today. My situation was that I got my Android studio updated. The most popular thing to replace the tools folder with the latest one wouldn’t work for me. Infact is not required in some cases.

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 sure cordova platform remove/add android will do the same stuff. Not tested though.

Working again !

I have my version stored in package.json, I updated to 6.2.3, re-added the platform then the build worked on ionic io.

  "cordovaPlatforms": [
    {
      "platform": "android",
      "version": "6.2.3",
      "locator": "android"
    },
  ]

I was using 6.1.0 before, so my guess is 6.1.0 and older aren’t compatible with the latest android sdk tools (26.0.1), which was added in 6.2.2.

TLDR:

  • If you use older android sdk tools use platform version 6.1.0 or older
  • If you use the 26.0.1+ sdk tools use version 6.2.2+ (includes ionic io builds)
1 Like

i am getting error while installation
add to body class: platform-android
ANDROID_HOME=C:\Users\IT\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk-9.0.1
Error: Requirements check failed for JDK 1.8 or greater

[ERROR] An error occurred while running cordova build android (exit code 1).