After we solved the problem of could not resolve com.android.tools.build: gradle: 7.0.2, we reported this error in build output
The most direct solution is to download the version of Android SDK build tools in SDK tools. The path is file >settings> Appearance& Behavior> System Settings> Android SDK> SDK Tools. Unfortunately, I couldn’t download it, so I changed the buildtoolsversion in APP/build.gradle to “31.0.2” of all my current 31.0.2 versions
In the project structure, we have also changed everything, but after running, we still report such an error
After I changed the version to 30.0.2, I still have this problem. Obviously, I have this version, but why not? When I checked my SDK tools, I found that 31.0.0 and 30.0.2/28.0.3/27.0.0 are under Android SDK build tools 31
So I guessed whether it could not be found under the file, so I deleted all except the 30.0.2 version I currently use
Close Android studio and open it again. Success