Is there any way to create a new flutter project with upgraded gradle version?

Viewed 2452

I am using android studio for flutter project. Every time when I create flutter android studio says a new gradle version is available. So then I have to change it manually to new version. The problem is when I try to run app , it will download to new version. If I do not change it some plugins gives an error work with the old version. This my build.gradle file.

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

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1' //here I have to change it to 3.5.1
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}...

I tried to upgrade flutter,dart,android studio,gradle. But it does not work. If I create a new android project , it was created with new version. So how to create a new flutter project with upgraded gradle version?

2 Answers

You can't. The Gradle version is hard coded to flutter app's template (the same for the kotlin version). Typically a flutter version is also not guaranteed to be compatible with the latest gradle version, so maybe stick with the version from the template until you are sure it's compatible.

try gradle wrapper --gradle-version 7.2 on the terminal.

Related