This section of the Flutter repository contains the command line developer tools for building Flutter applications on Android. What follows are some notes about updating this part of the tool.
The Android dependencies that Flutter uses to run on Android include the Android NDK and SDK versions, Gradle, the Kotlin Gradle Plugin, and the Android Gradle Plugin (AGP). The template versions of these dependencies can be found in gradle_utils.dart.
Follow the guides below when*...
All of the Android SDK/NDK versions noted in gradle_utils.dart
(compileSdkVersion
, minSdkVersion
, targetSdkVersion
, ndkVersion
) versions should match the values in Flutter Gradle Plugin (FlutterExtension
), so updating any of these versions also requires an update in flutter.groovy.
When updating the Android compileSdkVersion
, minSdkVersion
, or targetSdkVersion
, make sure that:
Also, make sure to also update to the same version in the following places:
packages/flutter_tools/gradle/src/main/groovy/flutter.groovy
.packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts
.packages/flutter_tools/gradle/build.gradle.kts
.When updating the Gradle version used in project templates (templateDefaultGradleVersion
), make sure that:
When updating the Kotlin Gradle Plugin (KGP) version used in project templates (templateKotlinGradlePluginVersion
), make sure that the framework integration & benchmark tests are running with at least this KGP version.
For information about the latest version, check https://kotlinlang.org/docs/releases.html#release-details.
When updating the Android Gradle Plugin (AGP) versions used in project templates (templateAndroidGradlePluginVersion
, templateAndroidGradlePluginVersionForModule
), make sure that:
When new versions of Gradle become available, make sure to:
maxKnownAndSupportedGradleVersion
) can be updated, and if so, take the necessary steps to ensure we are testing this version in CI.oneMajorVersionHigherJavaVersion
) based on current maximum supported Gradle version is up-to-date._javaGradleCompatList
that contains the Java/Gradle compatibility information known to the tool.For more information about the latest version, check https://gradle.org/releases/.
When new versions of the Android Gradle Plugin become available, make sure to:
maxKnownAgpVersion
).maxKnownAndSupportedAgpVersion
) can be updated, and if so, take the necessary steps to ensure that we are testing this version in CI._javaAgpCompatList
that contains the Java/AGP compatibility information known to the tool.For information about the latest version, check https://developer.android.com/studio/releases/gradle-plugin#updating-gradle.
* There is an ongoing effort to reduce these steps; see https://github.com/flutter/flutter/issues/134780.