Ionic run android failed, error gradle line 64

previously I can compile but after I updated my cordova something happened. I got this error when I run ionic run android in my CI :

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\Jay\testproject\platforms\android\CordovaLib\cordova.grad
le' line: 64

* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please install the Android build tools version
 19.1.0 or higher.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

What could be the problem here? :cry:

Upgrade your Android SDK tools using the SDK Manager.

I already did. I even have higher version of SDK. Previously everything was working.

So what’s inside the build-tools folder where you’ve installed the Android SDK?

Had the same problem with Android SDK Build tools version 20.
Installing version 19.1 along with it, resolved the issue.

3 Likes

Do you have ~/Android/Sdk/build-tools and $ANDROID_HOME/build-tools?

I faced a similar problem. After I’ve installed Android Studio, my build-tools was installed only in ~/Android/Sdk/build-tools (declared in my $PATH too), but the MyIonicProject/platforms/android/CordovaLib/cordova.gradle was trying to get build-tools path from $ANDROID_HOME (in my case $ANDROID_HOME is in /opt/android-studio), and build-tools directory wasn’t here.

I solved it creating a symbolic link:

$ ln -s ~/Android/Sdk/build-tools $ANDROID_HOME/build-tools

Ensure yourself that you are linking using the same user and group of files in the target directory.