2

This is not a duplicate since the other question aren't related and don't solve the problem at hand like this

Anyways, is there a way to upgrade Gradle to the latest version? I'm using Flutter

Hussein Al-Mosawi
  • 1,464
  • 3
  • 17
  • 37
  • it's not about flutter. you have to update it inside android studio. here : https://docs.gradle.org/current/userguide/upgrading_version_6.html – Benyamin Aug 14 '21 at 09:30
  • The problem is finding the latest working version. I'm struggling with the same problem. I created a new flutter project a couple of months ago and it was created with gradle 4.1.3. I'm pretty sure it will break if I update to the latest one. – Dpedrinha Aug 01 '22 at 16:50

2 Answers2

0

You can let Flutter determine the gradle version for the Android build. Make sure that the Flutter version that you're using is up-to-date by running flutter upgrade. Then delete the /android folder inside the Flutter project. Regenerate the Android build by running flutter create --platforms=android

Omatt
  • 8,564
  • 2
  • 42
  • 144
0

Open the flutter project in Android studio then go to android directory inside it their is a build.gradle open it then android studio would have an option to open in android studio view, open it, android studio would download needed Gradle version, then would tell you to update to latest version.

this is my current build.gradle

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

dependencies {
    classpath 'com.android.tools.build:gradle:7.4.2'
    // START: FlutterFire Configuration
    classpath 'com.google.gms:google-services:4.3.15'
    // END: FlutterFire Configuration
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

MiniDev99
  • 324
  • 1
  • 13