Picking the full suite of android versions can be difficult if you are not a full time android developer. This document is for contributors to understand what versions of common android tooling should be used in the flutter/flutter codebase.
**The most important thing is for any test, project, or app to have compatible versions. **
If versions need to be different then a comment explaining why and what is being evaluated should be included. All chosen versions should pass the minimum versions checks defined in DependencyVersionChecker
If the versions chosen are not known by gradle_utils.dart then update gradle_utils.dart.
targetSdk
.compileSdk
instead of compileSdkVersion
.flutter.compileSdkVersion
.// OK android { compileSdk = flutter.compileSdkVersion }
// OK if flutter.compileSdkVersion is not available like in an add to app example. android { compileSdk = 35 }
// NOT OK android { compileSdk 28 }
minSdk
.targetSdk
instead of targetSdkVersion
.targetSdk
takes human level effort to update. This is a design decision by the AGP team.targetSdk
may lag behind compile sdk because of the effort to update.targetSdk
version is intentionally different there should be a comment explaining why.// OK defaultConfig { targetSdk = flutter.targetSdkVersion }
// OK if flutter.compileSdkVersion is not available like in an add to app example. defaultConfig { targetSdk = 35 }
// NOT OK defaultConfig { targetSdk 28 }
AKA com.android.application
, com.android.tools.build:gradle
com.android.library
// OK dependencies { classpath "com.android.tools.build:gradle:8.8.1" }
// OK dependencies { // Testing backwards compatability of feature XYZ classpath "com.android.tools.build:gradle:7.5.2" }
Gradle versions are the least likley to break across minor version updates.
// OK distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
Changing kotlin versions is most likley to have an issue with another dependency and not the code under test.
// Ok ext.kotlin_version = "1.7.10" ... classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Ok compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() }
// Not ok compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "17" }
// Not ok compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = JavaVersion.VERSION_17.toString() }