Error while build ionic app?

while I run ionic cordova build android command I got error like below.,

studio
(node:5208) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): CordovaError: 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
(node:5208) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.

and my Ionic Info output is,

cli packages:

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

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.6
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v8.9.3
npm  : 5.5.1
OS   : Windows 7

Environment Variables:

ANDROID_HOME : C:\Users\DELL\AppData\Local\Android\Sdk

Misc:

backend : pro

Is there any solution for it.

Hi @AnbuR

Please install Gradle

sudo add-apt-repository ppa:cwchien/gradle

sudo apt-get update

sudo apt-get install gradle

thanks

1 Like

I am using in windows

could you update your android sdk ?

yes android studio version 3.0.1

Gradle install Page as well for Windows:

I managed it by install newest gradle and then using cordova-android Version 6.4.0
ionic cordova platform remove android
ionic cordova platform add android@6.4.0

I using cordova CLI version 7.1.0

for window

Scoop is a command-line installer for Windows inspired by Homebrew.

$ scoop install gradle

Chocolatey is “the package manager for Windows”.

$ choco install gradle

download zip file

https://services.gradle.org/distributions/gradle-4.4-all.zip

unzip file

Create a new directory C:\Gradle with File Explorer. add gradle in this folder

In File Explorer right-click on the This PC (or Computer) icon, then click Properties → Advanced System Settings → Environmental Variables.

Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-4.4\bin. Click OK to save.

Open a console (or a Windows command prompt) and run gradle -v to run gradle and display the version

I install manually but i got error like below.,

‘gradle’ is not recognized as an internal or external command,
operable program or batch file.

check this blog

https://www.360logica.com/blog/how-to-configure-gradle-on-windows-machine/

Still I got same issue Here I add my Ionic Info

cli packages: (C:\Users\BLCS Design\AppData\Roaming\npm\node_modules)

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

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.6
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.9.3
npm               : 5.5.1
OS                : Windows 7

Environment Variables:

ANDROID_HOME : C:\Users\BLCS Design\AppData\Local\Android\Sdk

Misc:

backend : pro

try using cordova-android Version 6.4.0 and cordova CLI version 7.1.0

npm install -g cordova@7.1.0
ionic cordova platform remove android
ionic cordova platform add android@6.4.0
5 Likes

Thanks, it works for me.

Thanks man, it’s working fiel with cordova@6.4.0