Flutter Error: Build Failed with an exception.

Your project requires a newer version of the Kotlin Gradle plugin.

Flutter Error: Build Failed with an exception. Your project requires a newer version of the Kotlin Gradle plugin.

image.png

If you are new to flutter, you eventually may come across this error.

Do not worry, all you need to do is go to this link -- kotlinlang.org/docs/gradle.html#plugin-and-.. and look for the version as seen here.

image.png

Go back to build.gradle file located in android folder.

image.png

Update the version number. image.png

Save. This will update the gradle build automatically with the right version and the error will go away.