Ionic Gradle error when ionic cordova build android

ANDROID_HOME=D:\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_144
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

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

And my ionic info is:

cli packages: (C:\Users\Qsek PC\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.5
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 25.2.5
Node              : v6.11.0
npm               : 3.10.10
OS                : Windows 10

Environment Variables:

ANDROID_HOME : D:\sdk

See Gradle | Installation

Run ionic cordova requirements to confirm it worked.

Also:

6.4.0 and 7.0.0 exist.

first of all remove android platform using below command

ionic cordova platform remove android

Then reinstall platform using

ionic cordova platform remove android@6.0.0

this method work for me

1 Like

Now you are using a cordova-android version that explicitly does not work with current tooling or Android releases.

it’s also worked for me