Search code examples
androidflutterdartgradle

Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher


error: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. The following dependencies do not satisfy the required version: project ':ar_flutter_plugin' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

android/build.gradle

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

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.1'
        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')
}

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



Solution

  • I actually tried to solve this problem in Flutter: enter image description here

    I found a solution for that here:

    Why am I getting this warning and how to resolve it "This version only understands SDK XML versions up to 2 but an SDK XML..."

    But then I ran into similar problem as yours.

    AFAIK the main problem is the limitations in the libraries we are using, and that it isn't prepared for the level we want to.

    If you use AS and look here:

    enter image description here

    under Flutter plugins, and find the module which is complaining

    enter image description here

    In my case it was "location:", and if you expand the "android" folder here you can find the contents of the gradle file:

    enter image description here

    AS you see, the level of 'ext.kotlin_version' is 1.4.20, which is too low.

    Either we need to find a new provider to our libraries, try to convince the creator to release an updated version, or try to manually change it (I personally don't like to tamper with libraries that way).