apache/cordova-android · error · RuntimeException

No usable Android build tools found. Highest ${minBuildTools

Error message

No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is ${highestBuildToolsVersion.getOriginalString()}; Recommended version is ${minBuildToolsVersionString}.

What it means

doFindLatestInstalledBuildTools found build-tools entries in the required major series, but the highest one is below MIN_BUILD_TOOLS_VERSION — for example 35.0.0 installed while the platform requires >= 35.0.3 (the message names the best same-major version found and the recommended one). Discovery only considers the min version's own major series (entries >= (major+1).0.0 are filtered out), so having a newer major series installed does not satisfy it. Only thrown during auto-discovery, i.e. when cdvBuildToolsVersion is not set.

Source

Thrown at framework/cordova.gradle:78

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

    def highestBuildToolsVersion = buildToolsDirContents
        .collect { new Version(it) }
        // Invalid inputs will be handled as 0.0.0
        .findAll { it.isHigherThan('0.0.0') && it.isLowerThan(maxVersion) }
        .max()

    if (highestBuildToolsVersion == null) {
        throw new RuntimeException("""
            No installed build tools found. Please install the Android build tools
            version ${minBuildToolsVersionString}.
        """.replaceAll(/\s+/, ' ').trim())
    }

    if (highestBuildToolsVersion.isLowerThan(minBuildToolsVersionString)) {
        throw new RuntimeException("""
            No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is
            ${highestBuildToolsVersion.getOriginalString()}; Recommended version
            is ${minBuildToolsVersionString}.
        """.replaceAll(/\s+/, ' ').trim())
    }

    highestBuildToolsVersion.getOriginalString()
}

String getAndroidSdkDir() {
    def rootDir = project.rootDir
    def androidSdkDir = null
    String envVar = System.getenv("ANDROID_HOME")
    if (envVar == null) {
        envVar = System.getenv("ANDROID_SDK_ROOT")
    }

    def localProperties = new File(rootDir, 'local.properties')

View on GitHub (pinned to 7c1e190064)

Solutions

  1. Install the exact recommended version from the message: sdkmanager 'build-tools;<Recommended version>'.
  2. After upgrading cordova-android, refresh the SDK (sdkmanager --update plus the pinned build-tools) since the minimum moves with platform releases.
  3. If you cannot install anything new, downgrade cordova-android to a release whose minimum you already meet — pinning an installed-but-lower version via -PcdvBuildToolsVersion will trip the explicit 'Expected Android Build Tools version >= ...' check instead.

Example fix

# before
$ sdkmanager --list_installed | grep 'build-tools;'
build-tools;35.0.0      # minimum required: 35.0.3

# after
$ sdkmanager 'build-tools;35.0.3'
# or, if the minimum moved with a platform upgrade:
$ npm i -D cordova-android@latest && cordova platform rm android && cordova platform add android
Defensive patterns

Strategy: validation

Validate before calling

# Compare best installed same-major version against the platform minimum before building
MIN=$(grep -oP '(?<=MIN_BUILD_TOOLS_VERSION": ")[^"]+' platforms/android/CordovaLib/cdv-gradle-config-defaults.json)
MAJOR=${MIN%%.*}
BEST=$(ls "$ANDROID_HOME/build-tools" | grep "^$MAJOR\." | sort -V | tail -1)
if [ -z "$BEST" ] || [ "$(printf '%s\n' "$MIN" "$BEST" | sort -V | head -1)" != "$MIN" ]; then
  echo "build-tools >= $MIN required; best $MAJOR.x installed: ${BEST:-none} — run: sdkmanager 'build-tools;$MIN'"; exit 1
fi

Prevention

When it happens

Trigger: SDK has an early release of the required series (e.g. 33.0.0) while the platform minimum is 33.0.2; a cordova-android upgrade raised MIN_BUILD_TOOLS_VERSION past what the machine's SDK snapshot provides.

Common situations: CI images pinned to an older build-tools that a new cordova-android release superseded; corporate machines with frozen SDK snapshots; developers who updated cordova-android (npm) but never updated the Android SDK side.

Related errors


AI-assisted analysis of apache/cordova-android@7c1e190064 (2026-08-22). Data as JSON: /api/errors/6c6ebd56497cb569. Report an issue: GitHub.