You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of today (2025-09-20), the Android Gradle Plugin (AGP) is at version 9.0.0-alpha05. This marks the first major release since AGP 8.0, which was introduced more than two years ago(2023-04).
According to the AGP Preview Release Notes, AGP 9.0.0 introduces a significant number of breaking changes. The Android community is still in the process of identifying migration strategies, with resources such as AGP Status Tracker documenting compatibility issues and workarounds.
Because Flutter supports a wide range of AGP versions, one key challenge will be ensuring compatibility. A likely near-term mitigation strategy is to apply:
android.newDsl=false
This would allow projects to defer adoption of the new DSL until much later in the AGP 9.x cycle (expected around next year), minimizing disruption while maintaining forward compatibility.
@jesswrd FYI, We have been working on Gradle 9 support let look into AGP 9 and see what work needs to be migrated.
@bc-lee Do you have a specific request here (like a flutter tool command that fails to work that we need to fix or having flutter add android.newDsl=false to project templates?) or were you filing an issue to let us know, which is still helpful.
Do you have a specific request here (like a flutter tool command that fails to work that we need to fix or having flutter add android.newDsl=false to project templates?) or were you filing an issue to let us know, which is still helpful.
No, I just wanted to remind you of the incompatibilities so the Flutter team doesn’t forget. I suggested using android.newDsl=false since that seems like the easiest way to handle them, but it’s up to the Flutter Android team. 🙂
so after some debugging and testing , this is what i have found :
creating a project using flutter create and updating these build files :
app/build.gradle.kts
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace ="com.example.demo_agp"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility =JavaVersion.VERSION_11
targetCompatibility =JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget =JavaVersion.VERSION_11.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId ="com.example.demo_agp"// You can update the following values to match your application needs.// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
flutter {
source ="../.."
}
pluginManagement {
val flutterSdkPath =
run {
val properties =java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath !=null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "9.0.0-alpha05" apply false
id ("org.jetbrains.kotlin.android") version "2.2.10" apply false
}
include(":app")
will result the build o fail with the error :
Build file 'C:\Users\Abdessalem\Desktop\demo_agp\android\app\build.gradle.kts'line: 1An exception occurred applying plugin request [id: 'kotlin-android']
>Failed to apply plugin 'kotlin-android'.
>Cannot add extension with name 'kotlin', as there is an extension already registered with that name.
*Try:
>Run with --info or --debug option to get more log output.
>Run with --scan to generate a BuildScan (Powered by Develocity).
>Get more help at https://help.gradle.org.
which is expected because according to the link given by OPSwitch to [built-in Kotlin](https://developer.android.com/build/releases/agp-preview#android-gradle-plugin-built-in-kotlin): The org.jetbrains.kotlin.android plugin is not compatible with the new DSL. which means that id("kotlin-android") in app/build.gradle.kts should be removed but when doing that will break the FGP because // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. with the error:
An exception occurred applying plugin request [id: 'dev.flutter.flutter-gradle-plugin']
>Failed to apply plugin 'dev.flutter.flutter-gradle-plugin'.
>java.lang.NullPointerException (no error message)
another issue is that AGP 9 introduced breaking changes for some API , the most important and related to our current issue being ApkVariant and here is the lint that appears 'interface ApkVariant : BaseVariant, InstallableVariant, AndroidArtifactVariant, InternalBaseVariant' is deprecated. Deprecated in Java. , here is the lint from android studio:
so apparently issue 166550 needs to be fixed before moving forward on this, there are other changes to to other APIs like ApplicationExtension which we currently use but it seems a bit simpler then the first one .
for the opt out :
adding android.newDsl=false to gradle.properties file and removing this bloc from app/build.gradle.kts:
results another error: The project is using an incompatible version (AGP 9.0.0-alpha05) of the Android Gradle plugin. Latest supported version is AGP 8.13.0 which is more confusing because i was able to start some tasks before with AGP 9.0.0-alpha05 but now it fails the moment i start any task.
after doing what android studio suggests and using AGP 8.13.0 the app starts as expected
CC @reidbaker
results another error: The project is using an incompatible version (AGP 9.0.0-alpha05) of the Android Gradle plugin. Latest supported version is AGP 8.13.0
This error indicates a mismatch between your AGP version and your Android Studio version. You can still build using the Gradle CLI.
If you want to use an AGP alpha version, you also need to use the corresponding Canary build of Android Studio. For example, the latest AGP 9.0.0-alpha06 is only compatible with Android Studio Otter | 2025.2.1 Canary 1, which was released on 2025-09-22 (just two days ago).
I have around 100 packages in my pubspec, so having a good report showing which packages are not compatible would be really helpful. if no time then no problem I know you're busy with more important issues.
At this point I would expect that most packages (or at least the ones that use kotlin) are not compatible. AGP 9 Came out the second week of january and kotlin usage is pretty popular. This particular import I expect to be widely used.
But to answer your question we dont have a flutter doctor for plugins or anything like that. The best advice I can give you is to regex your pub cache for build.gradle
find ~/.pub-cache -name build.gradle -print0 | xargs -0 grep org.jetbrains.kotlin.android that will work on your whole pub cache which is machine wide but it should give you an idea.
On my working machine of 378 packages in my pub cache I have 94 entries that contain org.jetbrains.kotlin.android but most appear to be example apps. Hope that helps.
yes 😅, all packages need migration but The Gradle stays on the same version for 2 years
What I would suggest is that they make a sub-agent or a an agent skill called flutter-gradle-9-migration which will make this so easy for everyone instead of just a migration document.
Anyway they are doing amazing work to make Flutter up to date ❤️
The main issue is that all packages must be migrated. If even a single package is migrated—like file_picker—the app won’t compile on Android. It’s essentially a trap 😭. I have to pin file_picker to 10.3.8 even there is a security fix on 10.3.9 😭
That's why a sub-agent or a an agent skill for migration is needed so all the community can add it faster
🚧🚧Any library upgrade to the Gradle 9, the users won't able to use it unless all packages are migrated 🚧🚧
@hugues1277 if you are referring to the file_picker you can't solve it until all the packages are migrated to The Gradle 9, or do you refer to a different issue?
You can use my script on your project root path to know how many packages need migration in your pubspec #175688 (comment)
for the libraries that crash change it like this
Before updating the Flutter plugins to support AGP 9 by removing built-in Kotlin, I'm auditing to see if the migration is backwards compatible with older versions of AGP here.
The remaining work here is being tracked separately in #180137 and #181557, please follow along there!
If you discover additional problems with AGP 9, please file an issue with specific repro steps and we'll take a look!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
reidbaker commentedon Sep 22, 2025
@jesswrd FYI, We have been working on Gradle 9 support let look into AGP 9 and see what work needs to be migrated.
@bc-lee Do you have a specific request here (like a flutter tool command that fails to work that we need to fix or having flutter add android.newDsl=false to project templates?) or were you filing an issue to let us know, which is still helpful.
reidbaker commentedon Sep 22, 2025
related flutter/packages#10016
bc-lee commentedon Sep 23, 2025
No, I just wanted to remind you of the incompatibilities so the Flutter team doesn’t forget. I suggested using
android.newDsl=falsesince that seems like the easiest way to handle them, but it’s up to the Flutter Android team. 🙂reidbaker commentedon Sep 23, 2025
OK thank you for the issue. We will investigate if/where we break with the new dsl.
[-]AGP 9.0.0 Incompatibility[/-][+]Audit flutter for compatibility with the AGP 9.0.0 new dsl[/+]AbdeMohlbi commentedon Sep 24, 2025
so after some debugging and testing , this is what i have found :
creating a project using
flutter createand updating these build files :will result the build o fail with the error :
which is expected because according to the link given by OP
Switch to [built-in Kotlin](https://developer.android.com/build/releases/agp-preview#android-gradle-plugin-built-in-kotlin): The org.jetbrains.kotlin.android plugin is not compatible with the new DSL.which means thatid("kotlin-android")inapp/build.gradle.ktsshould be removed but when doing that will break the FGP because// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.with the error:another issue is that AGP 9 introduced breaking changes for some API , the most important and related to our current issue being

ApkVariantand here is the lint that appears'interface ApkVariant : BaseVariant, InstallableVariant, AndroidArtifactVariant, InternalBaseVariant' is deprecated. Deprecated in Java., here is the lint from android studio:so apparently issue 166550 needs to be fixed before moving forward on this, there are other changes to to other APIs like ApplicationExtension which we currently use but it seems a bit simpler then the first one .
for the opt out :
adding
android.newDsl=falsetogradle.propertiesfile and removing this bloc fromapp/build.gradle.kts:results another error:
The project is using an incompatible version (AGP 9.0.0-alpha05) of the Android Gradle plugin. Latest supported version is AGP 8.13.0which is more confusing because i was able to start some tasks before withAGP 9.0.0-alpha05but now it fails the moment i start any task.after doing what android studio suggests and using
AGP 8.13.0the app starts as expectedCC @reidbaker
bc-lee commentedon Sep 24, 2025
This error indicates a mismatch between your AGP version and your Android Studio version. You can still build using the Gradle CLI.
If you want to use an AGP alpha version, you also need to use the corresponding Canary build of Android Studio. For example, the latest AGP
9.0.0-alpha06is only compatible with Android Studio Otter | 2025.2.1 Canary 1, which was released on 2025-09-22 (just two days ago).19 remaining items
amrgetment commentedon Jan 26, 2026
I have around 100 packages in my pubspec, so having a good report showing which packages are not compatible would be really helpful. if no time then no problem I know you're busy with more important issues.
reidbaker commentedon Jan 26, 2026
At this point I would expect that most packages (or at least the ones that use kotlin) are not compatible. AGP 9 Came out the second week of january and kotlin usage is pretty popular. This particular import I expect to be widely used.
But to answer your question we dont have a flutter doctor for plugins or anything like that. The best advice I can give you is to regex your pub cache for build.gradle
reidbaker commentedon Jan 26, 2026
find ~/.pub-cache -name build.gradle -print0 | xargs -0 grep org.jetbrains.kotlin.androidthat will work on your whole pub cache which is machine wide but it should give you an idea.On my working machine of 378 packages in my pub cache I have 94 entries that contain org.jetbrains.kotlin.android but most appear to be example apps. Hope that helps.
amrgetment commentedon Jan 26, 2026
Thanks a lot, I made a python script that make a decorated report for my project if someone need that
Python script for the Gradle 9 compatibility report check_gradle9_compat.py
AbdeMohlbi commentedon Jan 26, 2026
@reidbaker does this mean all our packages needs to do this also ?
amrgetment commentedon Jan 26, 2026
yes 😅, all packages need migration but The Gradle stays on the same version for 2 years
What I would suggest is that they make a sub-agent or a an agent skill called flutter-gradle-9-migration which will make this so easy for everyone instead of just a migration document.
Anyway they are doing amazing work to make Flutter up to date ❤️
amrgetment commentedon Jan 27, 2026
The main issue is that all packages must be migrated. If even a single package is migrated—like file_picker—the app won’t compile on Android. It’s essentially a trap 😭. I have to pin file_picker to 10.3.8 even there is a security fix on 10.3.9 😭
That's why a sub-agent or a an agent skill for migration is needed so all the community can add it faster
🚧🚧Any library upgrade to the Gradle 9, the users won't able to use it unless all packages are migrated 🚧🚧
hugues1277 commentedon Jan 27, 2026
i changed in gradle-wrapper.properties but no results
distributionUrl=https://services.gradle.org/distributions/gradle-9.3.0-all.zip
try :
Java -> VERSION_17
flutter clean
flutter pub get
flutter build apk
What is the method to follow to solve this problem ?
amrgetment commentedon Jan 27, 2026
@hugues1277 if you are referring to the file_picker you can't solve it until all the packages are migrated to The Gradle 9, or do you refer to a different issue?
You can use my script on your project root path to know how many packages need migration in your pubspec
#175688 (comment)
for the libraries that crash change it like this
jesswrd commentedon Feb 2, 2026
Before updating the Flutter plugins to support AGP 9 by removing built-in Kotlin, I'm auditing to see if the migration is backwards compatible with older versions of AGP here.
[-]Audit flutter for compatibility with the AGP 9.0.0 new dsl[/-][+]Audit flutter for compatibility AGP 9.0.0[/+]jmagman commentedon May 12, 2026
The remaining work here is being tracked separately in #180137 and #181557, please follow along there!
If you discover additional problems with AGP 9, please file an issue with specific repro steps and we'll take a look!
github-actions commentedon May 26, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.