skip to Main Content

The current Kotlin version is 1.9.22. I updated ” with ‘1.9.22’, but I’m still encountering the same error even after updating.

android>build.gradle

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

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

Error:

Your project requires a newer version of the Kotlin Gradle plugin.                     │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update C:UserskarthDesktopkarthikandroidbuild.gradle:                     │
│ ext.kotlin_version = '<latest-version>'                                                    │
└────────────────────────────────────────────────────────────────────────────────────────────

2

Answers


  1. Kotline 1.9.10

    Released: August 23, 2023

    For Android Studio Giraffe and Hedgehog, the Kotlin plugin 1.9.10 will be delivered with upcoming Android Studios updates.

    you can check on this link: https://kotlinlang.org/docs/releases.html#release-details

    Login or Signup to reply.
  2. 2024 Update

    The reason you are getting this error message is that you have installed some extra dependencies in your pubspec.yaml file. One of those external dependencies requires a newer version of the gradle plugin to run on your version of Android.

    How to fix this error in 2024.

    1. First, go to this website and find the latest Kotlin version
      https://kotlinlang.org/docs/releases.html#release-details

    2. After that open your build.gradle file and copy this code where it is located at
      E://your_project_path/android/build.gradle

       allprojects { 
           ext.kotlin_version = '1.9.24' //replace this line with the new version number
           repositories {
               google()
               mavenCentral()
           }
       }
      
    3. After that go to the settings.gradle file in the Android folder

       plugins {   
           id "dev.flutter.flutter-plugin-loader" version "1.0.0"   
           id "com.android.application" version "7.3.0" apply false   
           id "org.jetbrains.kotlin.android" version "1.9.24" apply false // replace the same version number here  
       }
      
    4. Now your build.gradle file and settings.gradle files are updated. But still, your error occurs because there is one mandatory step to do. Please remember in every build.gradle or settings.gradle update you should restart your project. I recommend your to close the entire project and reopen it using the VSCode or whoever you use as the IDE.

    Check the same steps on YouTube
    https://youtu.be/0SxMyy_b5Y0?si=tfXrv-UrTCtgjSv7

    Hurray! Thanks me later! Now your problem is solved!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search