I had to reinstall Android Studio for some reason. After installing, I am not able to build my project, getting this error
Failed to find Build Tools revision 31.0.0
There’s no warning or error showing in build.gradle file
I have tried changing compiledSdkVersion,buildToolsVersion and targetSdkVersion to 30
As you can see, if I change the version to 30, it is saying me to update to 31.
This is my project structure.
I have also tried Sync project with gradle files, Invalidate cashes, and restart, but no help. I don’t know what to do now.
5
Answers
Problem fixed.
Previously the class path in my project level gradle was 4.2.2, it was not showing any warning though.
I had to replace it with
And the project compiled successfully.
@SweetD3v's answer was helpful.
Make sure to replace the line containing
classpath "com.android.tools.build:gradle:<gradle_version>"
in your project level gradle withIt will add the latest gradle to your project.
If you still getting the error, then check if your compileSdkVersion & targetSdkVersion are 31.
Hope these little changes will solve your problem. 🙂
You will also need to change the "distributionUrl" in your
gradle-wrapper.properties
todistributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-bin.zip
And yes, as last option, try switching the buildToolsVersion from 31.0.0 to 30.0.2
I changed my build tools version to 30.0.2 at the project structure tab and it worked for me
in the app –
build.gradle
, change the buildToolsVersion to:try this one, it worked for me