{"record":{"id":"5aba76e8a206d747","repo":"apache/cordova-android","slug":"no-installed-build-tools-found-please-install-the","errorCode":null,"errorMessage":"No installed build tools found. Please install the Android build tools version ${minBuildToolsVersionString}.","messagePattern":"No installed build tools found\\. Please install the Android build tools version (.+?)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"framework/cordova.gradle","lineNumber":71,"sourceCode":"    try {\n        def buildToolsDir = new File(getAndroidSdkDir(), \"build-tools\")\n        buildToolsDirContents = buildToolsDir.list()\n    } catch (e) {\n        println \"An exception occurred while trying to find the Android build tools.\"\n        throw e\n    }\n\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","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/cordova-android/blob/7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3/framework/cordova.gradle#L53-L89","documentation":"doFindLatestInstalledBuildTools runs during gradle configuration when no explicit build-tools version is set. It resolves the SDK via getAndroidSdkDir(), lists $SDK/build-tools, parses each entry as a version, and keeps only those in the same major series as MIN_BUILD_TOOLS_VERSION (higher than 0.0.0 and lower than (major+1).0.0). If nothing survives — the directory is empty, missing, or holds only entries of a different major series — it throws this RuntimeException. A failure to locate the SDK itself also surfaces here, rethrown after the 'An exception occurred while trying to find the Android build tools.' println.","triggerScenarios":"ANDROID_HOME / ANDROID_SDK_ROOT / local.properties sdk.dir points at a folder without a build-tools subdirectory (wrong path, a JDK, or an empty SDK); the build-tools package was never installed on the machine; only a different major series is installed (e.g. solely 34.x while the platform minimum is 35.x, so discovery excludes it).","commonSituations":"Fresh CI docker images that ship platform-tools but no build-tools; ANDROID_HOME pointing to ~/android-sdk when the SDK actually lives in ~/Android/Sdk (case-sensitive path on Linux); CLI-only workflows where Android Studio never got the chance to auto-install build-tools on demand.","solutions":["Install the recommended build-tools package: sdkmanager 'build-tools;<version from the message>' (or Android Studio → SDK Manager → SDK Tools → Android SDK Build-Tools).","Verify which SDK path is actually used: echo $ANDROID_HOME $ANDROID_SDK_ROOT and cat platforms/android/local.properties — fix sdk.dir / env vars if they point at the wrong folder.","Confirm the install landed where the build looks: ls \"$ANDROID_HOME/build-tools\" must show a directory in the same major series as the message's version.","Alternatively pin an already-installed acceptable version for this build: ./gradlew -PcdvBuildToolsVersion=<installed> (it must still be >= the platform minimum or the later min-version check fires)."],"exampleFix":"# before\n$ ls \"$ANDROID_HOME/build-tools\"\n34.0.0          # minimum is 35.x — nothing usable in that series\n\n# after\n$ sdkmanager 'build-tools;35.0.0'\n$ ls \"$ANDROID_HOME/build-tools\"\n34.0.0 35.0.0","handlingStrategy":"validation","validationCode":"# Pre-flight before cordova build / gradlew\n: \"${ANDROID_HOME:?export ANDROID_HOME (or set sdk.dir in platforms/android/local.properties)}\"\nMAJOR=$(grep -oP '(?<=MIN_BUILD_TOOLS_VERSION\": \")\\d+' platforms/android/CordovaLib/cdv-gradle-config-defaults.json)\nls \"$ANDROID_HOME/build-tools\" 2>/dev/null | grep -q \"^$MAJOR\\.\" \\\n  || { echo \"No $MAJOR.x build-tools in $ANDROID_HOME — run: sdkmanager 'build-tools;<min-version>'\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake the required build-tools package into CI images at image-build time, not job time.","Export both ANDROID_HOME and ANDROID_SDK_ROOT in every build environment.","Pin -PcdvBuildToolsVersion to the exact installed version in CI to bypass discovery entirely."],"tags":["android-sdk","build-tools","gradle","environment","ci"],"backgroundTag":"missing-android-sdk-component","analyzedSha":"7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3","analyzedAt":"2026-08-22T04:57:58.868Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}