skip to Main Content

I am encountering an issue while trying to build my Flutter project in VS Code. The build fails with the following error message:

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 the version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of D:Flutterfavorite_placesandroidsettings.gradle.
Alternatively (if your project was created before Flutter 3.19), update D:Flutterfavorite_placesandroidbuild.gradle ext.kotlin_version = '<latest-version>'

Error Details:

Error: Gradle task assembleDebug failed with exit code 1

I have tried the following steps:

Updated the Kotlin version in my build.gradle file to the latest stable version: ext.kotlin_version = ‘1.9.10’
Updated the Android Gradle plugin to version 7.4.2.
Ran flutter clean and flutter pub get before attempting to rebuild.

Despite these changes, I am still encountering the same issue. Below is the relevant part of my build.gradle file:

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

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

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

Updated Kotlin Version: I updated the ext.kotlin_version in the build.gradle file to the latest stable version (1.9.10).

Updated Android Gradle Plugin: I updated the Android Gradle plugin to version 7.4.2 in the build.gradle file.
Cleared Cache and Rebuilt: I ran flutter clean, flutter pub get, and attempted to rebuild the project.

Checked the Error Log: I reviewed the detailed error log to try and pinpoint the exact issue.

I expected the project to build successfully without any errors after updating the Kotlin and Gradle plugin versions. However, the build continues to fail with the same error, suggesting that the Kotlin Gradle plugin needs to be updated or that there may be a configuration issue that I’m overlooking.

2

Answers


  1. Try checking if it is the correct version in settings.gradle file:

    plugins {
            id("org.jetbrains.kotlin.android") version "1.9.10"
        }
    
    Login or Signup to reply.
  2. You Just Need To Update This Line

    ext.kotlin_version = '2.0.10'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search