I encountered this error while building my first Flutter app using the Android emulator.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\NAVY\AndroidStudioProjects\Flutter_Tutorial\android\build.gradle' line: 13
* What went wrong:
A problem occurred evaluating root project 'android'.
> Build completed with 1 failures.
> java.lang.NoClassDefFoundError: /jetbrains/kotlin/gradle/plugin/AbstractKotlinAndroidPluginWrapper
android\build.gradle file
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app") // line 13
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
I searched a lot but couldn't find a solution. How to solve this?
I tried Flutter Clean, recreated the virtual mobile device, and added dependencies, but it didn't work.
Flutter Doctor also confirmed that everything was checked.