Skip to content

☔ Flutter Fully Supports AGP 9 #181557

Open

Description

@jesswrd

Fully supports means that developers can be on AGP 9 and opted into AGP 9 features/breaking changes. This issue will be complete once the flutter team does work to enable app and plugin developers to upgrade to AGP 9 and to opt-in to AGP 9 Built-in Kotlin and the AGP new DSL.

We audited AGP 9 for Flutter before AGP 9 release: #175688.
These were the original steps taken:

However, we later found that all Flutter plugins in the Android project must also migrate to Built-in Kotlin to avoid build failures. Normally, we would log helpful Flutter errors directing developers to setup guides when builds fail. However, since unmigrated plugins block builds, we extended the required Built-in Kotlin migration timeline by supporting both migrated and unmigrated states. By supporting both states, we can warn developers of the requirement and urge plugin authors to complete their migration. Without this broad support, app developers would be blocked because migrating plugins is only actionable by the plugin authors.

Note: Because AGP 9 had already launched before we realized all Flutter plugins required migration to Built-in Kotlin, we had to advise developers against adopting AGP 9 until we could support all migration states. We communicated this guidance through Flutter tooling error logs here, blog posts here, and Youtube shorts here.


Below is the updated approach/solution taken to fully support AGP 9.

Flutter works on AGP 9 (General/Simpler Breaking Changes)

These are breaking changes that are completely actionable by the Flutter team. There is no need for apps to opt-in or out of any features.

Flutter works on AGP 9 (opted out of breaking changes)

Built-in Kotlin

newDsl

Flutter works on AGP 9 (opted into breaking changes)

Built-in Kotlin

newDsl

Testing

AGP 9.x is fully validated in CI across the Flutter release support window, covering both opt-in/opt-out states for Built-in Kotlin alongside the applicable new DSL configurations. Because of this, the new DSL is tested uniformly, where all test apps are either strictly opted in or strictly opted out.

Depedency Management/Version Windowing For Each Flutter Release (where AGP 9+ is possible)

Tracking Ecosystem Migration to Built-in Kotlin

Documentation

Related Issues/PRs

Activity

  1. self-assigned this
    on Jan 27, 2026
  2. added
    P1High-priority issues at the top of the work list
    triaged-androidTriaged by Android platform team
    team-androidOwned by Android platform team
    on Jan 27, 2026
  3. 6 remaining items

  4. changed the title [-]☔ Flutter Supports AGP 9[/-] [+]☔ Flutter Fully Supports AGP 9[/+] on Jul 9, 2026
  5. Daracul commented on Aug 21, 2026

    @Daracul

    Add-to-app (include_flutter.groovy) fails with FGP NPE on AGP 9 defaults — repro from a production app

    Setup: Android host app on AGP 9.2.1 / Gradle 9.6.1, Flutter module included from source via include_flutter.groovy (add-to-app), Flutter 3.47.1, AGP 9 defaults (android.newDsl / android.builtInKotlin not overridden). All plugin dependencies already migrated off unconditional KGP.

    Gradle sync fails applying FGP to the module project:

    Caused by: java.lang.NullPointerException
        at com.flutter.gradle.FlutterPluginUtils.getLegacyAndroidExtension$gradle(FlutterPluginUtils.kt:514)
        at com.flutter.gradle.plugins.PluginHandler$Companion.configurePluginDependencies(PluginHandler.kt:218)
        at com.flutter.gradle.plugins.PluginHandler.configurePlugins$gradle(PluginHandler.kt:69)
        at com.flutter.gradle.FlutterPlugin.addFlutterTasks(FlutterPlugin.kt:505)
        at com.flutter.gradle.FlutterPlugin.apply(FlutterPlugin.kt:136)
    

    With newDsl=true the legacy BaseExtension is not registered, so extensions.findByType(BaseExtension::class.java)!! throws. #191218 appears to cover this exact path (buildModeFor / plugin dependency wiring) — however getLegacyAndroidExtension has ~14 call sites in 3.47.1 (PluginHandler.kt, FlutterPlugin.kt:249, FlutterPluginUtils.kt:533/797/923), so subsequent failures are likely after the first one is fixed.

    Is the add-to-app / include_flutter path covered by the AGP 9 migration test matrix? Happy to test snapshots against our host app.

  6. jesswrd commented on Aug 24, 2026

    @jesswrd
    ContributorAuthor

    Add-to-app (include_flutter.groovy) fails with FGP NPE on AGP 9 defaults — repro from a production app

    Setup: Android host app on AGP 9.2.1 / Gradle 9.6.1, Flutter module included from source via include_flutter.groovy (add-to-app), Flutter 3.47.1, AGP 9 defaults (android.newDsl / android.builtInKotlin not overridden). All plugin dependencies already migrated off unconditional KGP.

    Gradle sync fails applying FGP to the module project:

    Caused by: java.lang.NullPointerException
        at com.flutter.gradle.FlutterPluginUtils.getLegacyAndroidExtension$gradle(FlutterPluginUtils.kt:514)
        at com.flutter.gradle.plugins.PluginHandler$Companion.configurePluginDependencies(PluginHandler.kt:218)
        at com.flutter.gradle.plugins.PluginHandler.configurePlugins$gradle(PluginHandler.kt:69)
        at com.flutter.gradle.FlutterPlugin.addFlutterTasks(FlutterPlugin.kt:505)
        at com.flutter.gradle.FlutterPlugin.apply(FlutterPlugin.kt:136)
    

    With newDsl=true the legacy BaseExtension is not registered, so extensions.findByType(BaseExtension::class.java)!! throws. #191218 appears to cover this exact path (buildModeFor / plugin dependency wiring) — however getLegacyAndroidExtension has ~14 call sites in 3.47.1 (PluginHandler.kt, FlutterPlugin.kt:249, FlutterPluginUtils.kt:533/797/923), so subsequent failures are likely after the first one is fixed.

    Is the add-to-app / include_flutter path covered by the AGP 9 migration test matrix? Happy to test snapshots against our host app.

    @Daracul Can you make a separate issue for this? Also the Flutter team is in the process of migrating to the new AGP DSL such that Flutter Android apps (and also android host apps in add-to-app scenarios like in your case) can successfully build when opted-in to android.newDsl here.

    For now, if you want to successfully use AGP 9, you have to:

    1. Migrate to built-in kotlin (if applicable, if your host app currently applies KGP) or add android.builtInKotlin=false to your android host app's gradle.properties
    2. Set android.newDsl=false in your android host app'sgradle.properties

    ^The above is vaguely referenced in the Flutter Docs here. I'm gonna add more context and possibly make a separate more focused doc for developers utilizing add-to-app scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listplatform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions