This is a very common error Android developers see from many versions. I still couldn’t find the reason behind this error. However, I found there are some files missing that causes Gradle to presume the Build Tools are broken.
Check Build Tools
The first thing to do is check your build tools. On Mac, it can be found here:
/Library/Android/sdk/build-tools/
You can open Android Studion > Preferences and try to uninstall and re-install the Build Tool (from the build tools tab). But that is unlikely to solve this error. However, checking the folder above will give an idea of what exact versions are installed on your machine. Gradle will always use the latest available version.
Solution
To resolve the issue above on a Mac, run this command in your Terminal. You might need to change the build tool version number to the latest available in your build tools folder:
cd ~/Library/Android/sdk/build-tools/33.0.0-rc2 && mv d8 dx && cd lib && mv d8.jar dx.jar