Ionic can't recognize gradle


#1

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.


#2

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.


#3

Now I get this error


#4

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


#5

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


#6

Normally this should all be taken car of automatically.

ionic info output please.


#7


#8

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.


#9

now it says:

cordova -v
6.5.0


#10

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


#11

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


#12

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


#13

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.


#14

Exactly that. Now it’s working :slight_smile: