Ionic can't recognize gradle

when I hit “ionic build android” this is what I get:

“gradle” command is working, but ionic is taking the whole path to gradle as a command.

ANDROID_HOME and JAVA_HOME are correct?

You could try to install the next version of cordova-android: cordova platform update https://github.com/apache/cordova-android#6.2.2 This fixes some problems with current SDK versions.

Now I get this error image

Is the error message correct - does the file not exist?

Exactly, it doesn’t exist. I was looking for how to create it but I couldn’t find appropriate solution

Normally this should all be taken car of automatically.

ionic info output please.

image

Just noticed the “upgrade cordova” thingie in your first image, and the “telemetry note” further down. Run cordova telemetry on and cordova -v please - something is strange here. You shouldn’t get the upgrade warning.

now it says:

cordova -v
6.5.0

But no change at ionic build android? Does it still trigger you to update?

Still the same error.
No it doesn’t trigger update. I’ll try to install newest version of android studio

2 Likes

I installed newest Android Studio, updated SDK and everything what Android Studio suggested in its wizard. As suggested here (http://stackoverflow.com/a/42915493/1860890) I run

cordova platform update android@6.2.2

After that I run

ionic build android

After that Ionic downloaded and installed bunch of things but it worked.

This might have worked, not sure - http://stackoverflow.com/a/42907737/1860890 because Ionic was looking for gradle wrapper

1 Like

Cordova Android 6.2.2 was released yesterday and should fix all those problems. It is not installed by default yet (Cordova pins versions on the Cordova releases), so you have to run the cordova platform update android@6.2.2 manually after adding the android platform, but then you should be fine.

1 Like

Exactly that. Now it’s working :slight_smile: