skip to Main Content

I have a question about Flutter version 3.19.2. In this version, Flutter has removed the buildscript from the /android/build.gradle file:

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
}

Now, I’m wondering where to put the latest version of Kotlin. Could someone please guide me on the appropriate location for specifying the Kotlin version in this updated configuration?

Thank you in advance!

I have attempted to search for information on the Flutter documentation website under Breaking Changes, but I couldn’t find anything related to this particular issue.

2

Answers


  1. After the update of Flutter version 3.19.2. In this version, Flutter has removed the buildscript from the

     /android/build.gradle
    

    Now you can Add your latest version of Kotlin in settings.gradle

    /android/setting.gradle
    

    here is my setting.gradle file:

    pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }
    settings.ext.flutterSdkPath = flutterSdkPath()
    
    includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
    
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
    }
    
    plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.1.2" apply false
    id "org.jetbrains.kotlin.android" version "1.8.0" apply false
    id "com.google.gms.google-services" version "4.4.0" apply false
    }
    
    include ":app"
    
    Login or Signup to reply.
  2. kotlin plugin version is shifted to settings.gradle in newer version of flutter.
    you can find kotlin plugin version in settings.gradle inside plugins tag

    plugins {
        id "dev.flutter.flutter-plugin-loader" version "1.0.0"
        id "com.android.application" version "{agpVersion}" apply false
        id "org.jetbrains.kotlin.android" version "{kotlinVersion}" apply false
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search