{"record":{"id":"80a998c6d5b5d6c2","repo":"apache/cordova-android","slug":"expected-android-build-tools-version-cordovac","errorCode":null,"errorMessage":"Expected Android Build Tools version >= ${cordovaConfig.MIN_BUILD_TOOLS_VERSION}, but got Android Build Tools version ${cordovaConfig.BUILD_TOOLS_VERSION}. Please use version ${cordovaConfig.MIN_BUILD_TOOLS_VERSION} or later.","messagePattern":"Expected Android Build Tools version >= (.+?), but got Android Build Tools version (.+?)\\. Please use version (.+?) or later\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"framework/cordova.gradle","lineNumber":186,"sourceCode":"        cordovaConfig.BUILD_TOOLS_VERSION = cdvBuildToolsVersion\n    }\n    if (project.hasProperty('cdvAndroidXAppCompatVersion')) {\n        cordovaConfig.ANDROIDX_APP_COMPAT_VERSION = cdvAndroidXAppCompatVersion\n    }\n    if (project.hasProperty('cdvAndroidXWebKitVersion')) {\n        cordovaConfig.ANDROIDX_WEBKIT_VERSION = cdvAndroidXWebKitVersion\n    }\n\n    if (!cordovaConfig.BUILD_TOOLS_VERSION) {\n        cordovaConfig.BUILD_TOOLS_VERSION = doFindLatestInstalledBuildTools(\n            cordovaConfig.MIN_BUILD_TOOLS_VERSION\n        )\n    }\n\n    // Ensure the configured build tools version is at least our declared minimum\n    def buildToolsVersion = new Version(cordovaConfig.BUILD_TOOLS_VERSION)\n    if (buildToolsVersion.isLowerThan(cordovaConfig.MIN_BUILD_TOOLS_VERSION)) {\n        throw new RuntimeException(\"\"\"\n            Expected Android Build Tools version >= ${cordovaConfig.MIN_BUILD_TOOLS_VERSION},\n            but got Android Build Tools version ${cordovaConfig.BUILD_TOOLS_VERSION}. Please use version ${cordovaConfig.MIN_BUILD_TOOLS_VERSION} or later.\n        \"\"\".replaceAll(/\\s+/, ' ').trim())\n    }\n}\n\ndef doVerifyCordovaConfigForBuild() {\n    if (cordovaConfig.COMPILE_SDK_VERSION < cordovaConfig.SDK_VERSION) {\n        println \"The \\\"compileSdkVersion\\\" (${cordovaConfig.COMPILE_SDK_VERSION}) should be greater than or equal to the the \\\"targetSdkVersion\\\" (${cordovaConfig.SDK_VERSION}).\"\n    }\n}\n\n// Properties exported here are visible to all plugins.\next {\n    def defaultsFilePath = './cdv-gradle-config-defaults.json'\n    def projectConfigFilePath = \"$rootDir/cdv-gradle-config.json\"\n    def targetConfigFilePath = null\n","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/apache/cordova-android/blob/7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3/framework/cordova.gradle#L168-L204","documentation":"After doApplyCordovaConfigCustomization applies overrides (the cdvBuildToolsVersion gradle property, or a hand-edited cdv-gradle-config.json BUILD_TOOLS_VERSION), cordova.gradle verifies with the versioncompare library that the resulting BUILD_TOOLS_VERSION is not below MIN_BUILD_TOOLS_VERSION. Unlike the auto-discovery errors, this one fires only when a version was explicitly supplied — so the offending value came from your -P flag, project gradle.properties, or config json.","triggerScenarios":"Building with ./gradlew -PcdvBuildToolsVersion=30.0.3 (a legacy value from old docs) while the platform requires a much higher minimum; cdvBuildToolsVersion pinned in the project's gradle.properties; cdv-gradle-config.json's BUILD_TOOLS_VERSION left at an old value after a cordova-android upgrade raised the minimum.","commonSituations":"CI build commands copy-pasted from an older project; teams that pin all tool versions by convention and carry the pin across platform upgrades; manual edits of cdv-gradle-config.json drifting from the platform's declared minimum.","solutions":["Drop the override — remove -PcdvBuildToolsVersion / the cdvBuildToolsVersion line so auto-discovery selects the newest installed version in the required series (>= minimum).","Or raise the pin to at least the minimum named in the message and install that exact package: sdkmanager 'build-tools;<version>'.","If you must stay on older build-tools than the platform minimum, downgrade cordova-android to a release whose MIN_BUILD_TOOLS_VERSION you satisfy."],"exampleFix":"# before\n$ ./gradlew assembleRelease -PcdvBuildToolsVersion=30.0.3\n... Expected Android Build Tools version >= 35.0.0 ...\n\n# after — let discovery pick an installed >= minimum version\n$ ./gradlew assembleRelease\n# or pin a valid one you installed:\n$ sdkmanager 'build-tools;35.0.0' && ./gradlew assembleRelease -PcdvBuildToolsVersion=35.0.0","handlingStrategy":"validation","validationCode":"# If your build pins build-tools, check the pin against the platform minimum first\nif [ -n \"$PIN\" ]; then\n  MIN=$(grep -oP '(?<=MIN_BUILD_TOOLS_VERSION\": \")[^\"]+' platforms/android/CordovaLib/cdv-gradle-config-defaults.json)\n  [ \"$(printf '%s\\n' \"$MIN\" \"$PIN\" | sort -V | head -1)\" = \"$MIN\" ] \\\n    || { echo \"cdvBuildToolsVersion=$PIN is below platform minimum $MIN\"; exit 1; }\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not pin cdvBuildToolsVersion unless a reproducible CI toolchain requires it.","When you must pin, derive the pin from the platform's declared MIN_BUILD_TOOLS_VERSION in the same script instead of hardcoding an old value.","Re-check (or drop) all -Pcdv* pins after each cordova-android upgrade."],"tags":["gradle","build-tools","version-pin","android"],"backgroundTag":"android-build-tools-version-mismatch","analyzedSha":"7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3","analyzedAt":"2026-08-22T04:57:58.868Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}