I’m unable to build and run my flutter project. Every time I run the project it gives me this error
FAILURE: Build failed with an exception.
- What went wrong:
Could not create an instance of type org.gradle.invocation.DefaultGradle.
Could not configure services using GradleScopeCompileServices.configure().
I searched and tried the following solution but nothing has worked so far:
- Clean & Build Project
- Deleted .gradle & .dart_tools folder
- Downgraded Gradle version
I’m using Android studio 4.2.1. Let me know if you need anything else. Thanks in advance!
2
Answers
I tried many solutions but the following worked for me:
I am use Flutter 2.5, same issue.
set ./android/build.gradle file to newer version:
classpath ‘com.android.tools.build:gradle:7.0.0’
}