Android Gradle says an installed Build Tools revision is corrupted
The build stops and reports that an installed Build Tools revision is corrupted and should be removed and installed again with the SDK ManagerShort answer
The Android Gradle plugin reports that the Build Tools revision in your SDK is corrupted and refuses to use it. Remove the revision and install it again with sdkmanager or the SDK Manager. If the revision is not needed, delete the buildToolsVersion line so the plugin uses its own default.
Fix it fast
1Find out which cause you have
List the revisions that exist in the SDK and look inside the one named in the error. A healthy revision holds many tools, a corrupted one is missing some or is nearly empty.
ls "$ANDROID_HOME/build-tools" ls "$ANDROID_HOME/build-tools/31.0.0"2Match what you see, then jump to its fix
What does the error look like?
The build stops and reports that an installed Build Tools revision is corrupted and should be removed and installed again with the SDK Manager
Cause 1 of 2
The installed Build Tools revision is damaged
1Check
Build Tools are installed to the build-tools folder of the SDK, one folder per revision. Reinstalling replaces the whole folder.
ls "$ANDROID_HOME/build-tools"
df -h "$ANDROID_HOME"2Fix
Uninstall that revision, then install it again. With enough free disk space, this replaces the folder.
sdkmanager --uninstall "build-tools;31.0.0"
sdkmanager --install "build-tools;31.0.0"3Verify
The folder has its tools again and the build moves past this error.
ls "$ANDROID_HOME/build-tools/31.0.0"
./gradlew assembleDebugConfirmed by developer.android.com
Cause 2 of 2
The project pins a revision that you do not need
1Check
The buildToolsVersion property specifies the version of the SDK Build Tools to use when building the project, so a line there decides which revision the build opens.
grep -rn "buildToolsVersion" --include=*.gradle --include=*.kts .2Fix
Set buildToolsVersion to a revision that is installed and works, and install that revision with sdkmanager if it is missing.
// module build.gradle.kts
android {
buildToolsVersion = "36.0.0" // a revision you have installed
}
# install it if needed
sdkmanager --install "build-tools;36.0.0"3Verify
Sync the project and run a build. It uses the installed revision.
./gradlew assembleDebugConfirmed by developer.android.com
How do I stop it coming back?
- Do not close Android Studio or cancel SDK Manager while a package is downloading.
- Keep free disk space above the size of the package before you start an install.
- Pin buildToolsVersion only to a revision you have installed, and keep that line in one place.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Gradle will not install an Android SDK package until you accept its licence
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Gradle tried to download an SDK package, but the licence for it is not recorded on this machine.
3 causes, each with a fixMobile apps
Gradle cannot find the Android SDK on this machine
FAILURE: Build failed with an exception. What went wrong: SDK location not found.
Gradle looks for the Android SDK in the sdk.dir line of android/local.properties and in the ANDROID_HOME environment variable, and found neither.
4 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fix