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

I do not depend on locally installed Android SDK. And until last week was able to build APKs relying completely on Ionic Cloud Services i.e. by using CLI command -

ionic package build android --profile <security_profile_on_Ionic_Apps>

In the past, I never relied on doing this to depend on locally installed android SDKs and it worked well.

ionic platform add android

Since the beginning of this week, I am getting below error while building APKs using Ionic CLI -

ANDROID_HOME=/opt/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: /opt/android-sdk/tools/templates/gradle/wrapper

I have tried installing latest cordova @7.0.1
npm install -g cordova
npm install -g ionic cordova

and also, gradle globally
npm install -g ionic gradle

Please help!!

I downloaded the zip file and paste the tools directory in android-sdk-linux directory instead old tools directory…but it still shows the same error to me.:frowning:

If you are using ionic package this thread here is not relevant to you in any way. Search the forum for current posts about “Ionic Package” to see solutions for your problem.

I solve this issue by downloading gradle-4.0 Gradle official website

and you have to manually add the environment path in the bash_profile file. add below code in that file

export PATH=$PATH/opt/gradle/gradle-4.0/bin

be clear that you have to keep the gradle file in opt directory if you are using linux…or you can give the exact path where the gradle file is stored…Thankyou…

this works… thanks bro

Just add to your config.xml:
<engine name="android" spec="^6.2.3"/>

And try again.

1 Like

This has solved also the problem in my case.
I’m working in Ubuntu 16.04.3. I have an Ionic 1 project. After updating everything (node, ionic, SDK packages) to the latest ones, because I had to start an Ionic 3 project, I got the same error in the Ionic 1 project, while the Ionic 3 worked perfectly. I had already Android SDK Tools V26.1.1. After replacing the tools directory the problem was solved.
Thanks

Thank you very much @brickolicious this works for me. but get new errors like
could not find com.android.support:support-v4:27.0.1.

so i edit build.gradle file at de repositories and dependencies as;

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'   
}
allprojects {
    repositories {
        mavenCentral();
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }

then replae these lines in the build.gradle;
compileSdkVersion 27
// compileSdkVersion cdvCompileSdkVersion
buildToolsVersion “26.0.2”
// buildToolsVersion cdvBuildToolsVersion

then works fine.