Here is how I upgraded gradle in my older Flutter project:
In the project open android/build.gradle check the classpath version of gradle being used and update that in your old Flutter project. For me today it looks like this:
classpath 'com.android.tools.build:gradle:4.1.0'
In the temp project open android/gradle/wrapper/gradle-wrapper.properties and check the distributionUrl. Update your old project to use the same one. For me today it looks like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
Rerun your app. It has to download the new version of gradle to the android/.gradle directory so the first time might take a while.
Here is how I upgraded gradle in my older Flutter project:
1. Create a new temp project with the latest version of Flutter. You'll use this to see what version of gradle Flutter is using nowadays.
2. In the temp project open **android/build.gradle** check the classpath version of gradle being used and update that in your old Flutter project. For me today it looks like this:
classpath 'com.android.tools.build:gradle:4.1.0'
3. In the temp project open **android/gradle/wrapper/gradle-wrapper.properties** and check the `distributionUrl`. Update your old project to use the same one. For me today it looks like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
3. Rerun your app. It has to download the new version of gradle to the `android/.gradle` directory so the first time might take a while.