2

When I try to build app it throws error - your project requires a newer version of the kotlin gradle plugin.

 [!] 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>'

I have already upgrade my android/build.gradle as below.

buildscript {
    ext.kotlin_version = '1.7.20'
    repositories {
        google()
        jcenter()
    }

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

And my android/gradle/wrapper/gradle-wrapper.properties as below

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

Please any one can help me?

blackgreen
  • 34,072
  • 23
  • 111
  • 129
Dhaval Chaudhari
  • 417
  • 8
  • 22

1 Answers1

4

I had the same issue. and I tried multiple solutions. none worked. finally got the solution. copy and past the below code in android/build.gradle

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

dependencies {
    classpath 'com.android.tools.build:gradle:7.2.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.3.10'

}

and also change distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip in android/gradle/wrapper/gradle-wrapper.properties