Com.gradle.scan.agent.serialization.scan.a.g error

When I run the app in Android Studio, I get this error which I didn’t find any solution for this.
“Could not initialize class com.gradle.scan.agent.serialization.scan.a.g”


Can you provide the Gradle version and Gradle Enterprise Gradle plugin version used? Please run the build with -s and attach the error and stacktrace which will be printed at the end of the build. We need this information to get more insights into the error itself.