{"record":{"id":"6c6ebd56497cb569","repo":"apache/cordova-android","slug":"no-usable-android-build-tools-found-highest-min","errorCode":null,"errorMessage":"No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is ${highestBuildToolsVersion.getOriginalString()}; Recommended version is ${minBuildToolsVersionString}.","messagePattern":"No usable Android build tools found\\. Highest (.+?)\\.x installed version is (.+?); Recommended version is (.+?)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"framework/cordova.gradle","lineNumber":78,"sourceCode":"\n    def minBuildToolsVersion = new Version(minBuildToolsVersionString)\n    def maxVersion = new Version((minBuildToolsVersion.getMajor() + 1) + \".0.0\")\n\n    def highestBuildToolsVersion = buildToolsDirContents\n        .collect { new Version(it) }\n        // Invalid inputs will be handled as 0.0.0\n        .findAll { it.isHigherThan('0.0.0') && it.isLowerThan(maxVersion) }\n        .max()\n\n    if (highestBuildToolsVersion == null) {\n        throw new RuntimeException(\"\"\"\n            No installed build tools found. Please install the Android build tools\n            version ${minBuildToolsVersionString}.\n        \"\"\".replaceAll(/\\s+/, ' ').trim())\n    }\n\n    if (highestBuildToolsVersion.isLowerThan(minBuildToolsVersionString)) {\n        throw new RuntimeException(\"\"\"\n            No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is\n            ${highestBuildToolsVersion.getOriginalString()}; Recommended version\n            is ${minBuildToolsVersionString}.\n        \"\"\".replaceAll(/\\s+/, ' ').trim())\n    }\n\n    highestBuildToolsVersion.getOriginalString()\n}\n\nString getAndroidSdkDir() {\n    def rootDir = project.rootDir\n    def androidSdkDir = null\n    String envVar = System.getenv(\"ANDROID_HOME\")\n    if (envVar == null) {\n        envVar = System.getenv(\"ANDROID_SDK_ROOT\")\n    }\n\n    def localProperties = new File(rootDir, 'local.properties')","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/cordova-android/blob/7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3/framework/cordova.gradle#L60-L96","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install the exact recommended version from the message: sdkmanager 'build-tools;<Recommended version>'.","After upgrading cordova-android, refresh the SDK (sdkmanager --update plus the pinned build-tools) since the minimum moves with platform releases.","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."],"exampleFix":"# before\n$ sdkmanager --list_installed | grep 'build-tools;'\nbuild-tools;35.0.0      # minimum required: 35.0.3\n\n# after\n$ sdkmanager 'build-tools;35.0.3'\n# or, if the minimum moved with a platform upgrade:\n$ npm i -D cordova-android@latest && cordova platform rm android && cordova platform add android","handlingStrategy":"validation","validationCode":"# Compare best installed same-major version against the platform minimum before building\nMIN=$(grep -oP '(?<=MIN_BUILD_TOOLS_VERSION\": \")[^\"]+' platforms/android/CordovaLib/cdv-gradle-config-defaults.json)\nMAJOR=${MIN%%.*}\nBEST=$(ls \"$ANDROID_HOME/build-tools\" | grep \"^$MAJOR\\.\" | sort -V | tail -1)\nif [ -z \"$BEST\" ] || [ \"$(printf '%s\\n' \"$MIN\" \"$BEST\" | sort -V | head -1)\" != \"$MIN\" ]; then\n  echo \"build-tools >= $MIN required; best $MAJOR.x installed: ${BEST:-none} — run: sdkmanager 'build-tools;$MIN'\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After every cordova-android upgrade, install the build-tools version named in cdv-gradle-config-defaults.json MIN_BUILD_TOOLS_VERSION.","Keep CI SDK images current (sdkmanager --update) rather than frozen snapshots.","Check installed versions with sdkmanager --list_installed as a CI smoke step before the real build."],"tags":["android-sdk","build-tools","version","gradle","upgrade"],"backgroundTag":"android-build-tools-version-mismatch","analyzedSha":"7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3","analyzedAt":"2026-08-22T04:57:58.868Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}