[Solved] Your project requires a newer version of the kotlin gradle plugin Error

If you are getting "your project requires a newer version of the kotlin gradle plugin" error while running your Flutter app, see the solution below to solve this error in Flutter. This error occurs, when you have an older version of kotlin at build.gradle. 

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':fluttertoast:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 45s
Running Gradle task 'assembleDebug'...                            107.9s

┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                                                                            │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, 
| then update E:\flutter_apps\geodata\android\build.gradle: │ │ ext.kotlin_version = '<latest-version>' │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Exception: Gradle task assembleDebug failed with exit code 1

Here is the error message with the fix suggestion given by the Flutter SDK.

Go to the Kotlin Gradle Plugin version checkup page, and get the latest version from the page.

The latest version we get is "1.6.21", now you have to update the version code at build.gradle located at android\build.gradle path.

buildscript {
    ext.kotlin_version = '1.6.21'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

change the version no. of ext.kotlin_version.

In this way, you can solve "your project requires a newer version of the kotlin gradle plugin" error in Flutter.

No any Comments on this Article


Please Wait...