question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix error message when installed build tools version greater than MIN_BUILD_TOOLS_VERSION + 1

See original GitHub issue

Bug Report

Problem

I have build tools 32 installed. Compiling an android application using cordova-android 10.1.1 fails with the message:

This is clearly misleading and led me to waste a fair amount of time trying to track down the real problem

What is expected to happen?

Compilation should fail and display an error message indicating the required versions of build tools, something like No usable build tools found. Android build tools version should be between 30.0.3 and 31.0.0.

What does actually happen?

Compilations fails with the message: No installed build tools found. Install the Android build tools version 30.0.3 or higher.

Information

There are related issues about the compilation failing, but they don’t address the problem of the misleading error message: https://github.com/apache/cordova-android/issues/1288 https://github.com/apache/cordova-android/issues/1335

Command or Code

cordova compile android

Environment, Platform, Device

Windows 10.

Version information

Cordova cli 11.0.0 Cordova android 10.1.1

Checklist

  • [ x] I searched for existing GitHub issues
  • [ x] I updated all Cordova tooling to most recent version
  • [ x] I included all the necessary information above

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
breautekcommented, Feb 4, 2022

In regards to the error message, it’s definitely an oversight. It should be more descriptive.

The code in question attempts to automatically find the latest version of build tools that is installed, but it should not automatically choose the next major version. Doing so is error prone as major version jumps generally indicate some sort of breaking change.

android-buildToolsVersion preference should forcefully allow a particular build tools version but changing the build tools version will likely cause build issues. E.g. cordova-android@10 is only tested with API 30 and there are known incompatibilities with version build tools 31. I doubt build tools 32 will work right now.

2reactions
jmarshall-comcommented, Feb 4, 2022

I had this same problem and finally found the problem in cordova.gradle, line 57:

def maxVersion = new Version((minBuildToolsVersion.getMajor() + 1) + ".0.0")

… and then line 62:

.findAll { it.isHigherThan('0.0.0') && it.isLowerThan(maxVersion) }

Is there a good reason for setting a maxVersion to be no more than 1 major version higher than minversion? At a minimum, the error message should change to reflect what the highest allowed version is, not just say “version 30.0.3 or higher.” I spent a lot of time tracking this down.

I’m using Cordova 11 with build tools 32, on a brand new Mac mini.

Thanks!

EDIT: Ah, I see that using any build tools above 30.0.3 won’t work correctly, so there is indeed that good reason to have a maxVersion. (Build tools 30.0.3 is the only version supported by Android Studio that works here-- versions 31.x and 32.x lead to “Installed Build Tools revision X is corrupted.”). Anyway, I uninstalled version 32 and installed 30.0.3 and it seems to work correctly now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ionic build Android | error: No installed build tools found. ...
No installed build tools found. Please install the Android build tools version 19.1. 0 or higher. Try: Run with --stacktrace option to get...
Read more >
Installed Build Tools revision 32.0.0 is corrupted. Remove ...
This error is due to a packaging mistake with the Android SDK. To resolve on Windows OS: a. Navigate to the build tools...
Read more >
Gradle build fails with build tools 31.0.0
Building a gradle project throws this error: "Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager ...
Read more >
Android Platform Guide - Apache Cordova
It is recommended to install the highest supported version of the SDK Platform and Build Tools based on the project's installed version of...
Read more >
Android SDK and Emulator
This section describes how to install and configure these resources. Prerequisites To Download. For V8 SP2. Required Android SDK Build Tool version is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found