"ionic cordova build android" failed - could not find an installed version of Gradle

I’m getting the following error when building android app locally:

ionic cordova build android
Running app-scripts build: --iscordovaserve --external-ip-required --nobrowser

[22:35:07] build dev started …
[22:35:07] clean started …
[22:35:07] clean finished in less than 1 ms
[22:35:07] copy started …
[22:35:07] transpile started …
[22:35:11] transpile finished in 3.77 s
[22:35:11] preprocess started …
[22:35:11] deeplinks started …
[22:35:11] deeplinks finished in 15 ms
[22:35:11] preprocess finished in 15 ms
[22:35:11] webpack started …
[22:35:11] copy finished in 4.44 s
[22:35:21] webpack finished in 10.32 s
[22:35:21] sass started …
[22:35:23] sass finished in 2.08 s
[22:35:23] postprocess started …
[22:35:23] postprocess finished in 13 ms
[22:35:23] lint started …
[22:35:23] build dev finished in 16.26 s

cordova build android
:heavy_multiplication_x: Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

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

    JAVA_HOME=C:\Program Files\Java\jdk1.8.0_51
    Error: Could not find an installed version of Gradle either in Android Studio,
    or on your system to install the gradle wrapper. Please include gradle
    in your path, or install Android Studio

This is my environment configuration:

ionic info

global packages:

@ionic/cli-utils : 1.2.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.2.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.2.1
@ionic/cli-plugin-ionic-angular : 1.2.0
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.3.0


Node       : v6.10.2
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed

So did you do what the error message tells you to do?

No. I never had to install or configure gradle … did anything change with the new version of cordova or ionic, or is it the new version of android sdk?


What is the best way to install or configure it?


Download and install Android Studio - should take care of most of the stuff automagically.

And yes, Android SDK is moving stuff around with minor and even patch releases. cordova-android is trying to keep up, but it’s very hard.

I have android studio installed and it has all functioned perfectly for months. So why should this happen now. I tried to removed a plugin (crosswalk) tried to install a new one (with the lite flag) this failed. They when trying to run android I get these issues.

I have re-added the platform with no luck.
Any tips or ideas.

Open a new topic and include all relevant information please. (ionic info, error message, command executed etc)

I fixed it in the end by installing Gradle separately. Works lovely now. Thanks for the response