If you open a project in Android Studio and see an error similar to this:
No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.gradle.plugin.api-version’ with value ‘7.5’ but:
This is a Java version error, to solve this follow the steps below:
- Go to menu File -> Settings.
- Go to Build, Execution, Deployment -> Build Tools -> Gradle and change Gradle JDK to version 11. Then click Apply and OK.
- Sync your project again (press Try Again) or restart your project.