Repository navigation
[BUG] Fatal Build Incompatibility: Flutter 3.47.2 + AGP 9.1.0 + Gradle 9.3.1 + Android SDK 37 (Windows) #192111
Description
Activity
- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage teamfound in release: 3.47Found to occur in 3.47Found to occur in 3.47waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter respondsneeds repro infoAutomated crash report whose cause isn't yet knownAutomated crash report whose cause isn't yet known
on Sep 1, 2026 Hi @bahaa599599, thanks for the thorough writeup. The issue is that this is really about seven separate problems in one report, so there's no single fix that could close it. Could you open a focused issue for each one, with a minimal repro?
A couple you can skip so you don't file them again: the SDK 37 license status one is already fixed in #191487 (see #191554), and signingConfigs.getByName("debug") is just how the Kotlin DSL works, not a bug.
Also worth knowing, AGP 9.1.0, Gradle 9.3.1, Kotlin 2.4.0 and the newDsl / builtInKotlin flags are all ahead of what 3.47.2 officially supports, so some of this should sort itself out once that support lands.
The one that looks like a real bug on our side is the AGP 9 newDsl ClassCastException (ApplicationExtensionImpl to AbstractAppExtension). If you file that on its own with a small project, we can act on it.
Hi @mbcorona
Update: Confirmed Regression on Minimal Clean Project
I have successfully reproduced this fatal build failure on a completely new and clean Flutter project (testproject) with no third-party dependencies. This confirms that the issue resides within the dev.flutter.flutter-gradle-plugin and its current inability to handle the strict AGP 9.0+ DSL interfaces.
Steps taken for Minimal Reproduction:-
Created a new project via flutter create testproject.
-
Updated gradle-wrapper.properties to Gradle 9.3.1.
-
Updated settings.gradle.kts to AGP 9.1.0.
-
Enabled Modern Mode in gradle.properties: android.newDsl=true android.builtInKotlin=true
-
Executed flutter run.
Result on Clean Project:
The build fails immediately with the exact same ClassCastException: What went wrong: An exception occurred applying plugin request [id: 'dev.flutter.flutter-gradle-plugin']
Failed to apply plugin 'dev.flutter.flutter-gradle-plugin'. class com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated_Decorated cannot be cast to class com.android.build.gradle.AbstractAppExtension
Technical Root Cause:
As confirmed by the verbose logs, the crash occurs at: com.flutter.gradle.FlutterPlugin.addFlutterTasks(FlutterPlugin.kt:354)
The plugin is attempting to cast AGP's new ApplicationExtension to the legacy AbstractAppExtension internal class. This is a direct incompatibility with AGP 9.1.0's architecture.
Request for Guidance on Stable Configuration
While I wait for a fix for this regression, I would appreciate your advice on the most stable and recommended configuration for Flutter 3.47.2 that avoids these toolchain conflicts while maintaining compatibility with modern plugins (like Firebase).
What is the currently verified "Safe Stack" for Flutter 3.47.2? Specifically:
• Which AGP version is fully tested and stable with this release? (e.g., 8.7.2 or 8.10?)• Which Gradle version is recommended to avoid the "Unsupported Gradle Project" warning?
• Should I avoid Android SDK 37 / API 36 for now to ensure plugin compatibility?
Thank you for your assistance in resolving this critical toolchain issue.
Final Confirmation: Reproducible on Clean "Hello World" Project
I have confirmed that this issue is a core Flutter SDK regression. I created a completely new project (
flutter create testproject) with NO external plugins and applied the AGP 9.1.0 / Gradle 9.3.1 toolchain.Result:
The build fails with the exact same
ClassCastException.Stack Trace Analysis:
The verbose logs pinpoint the failure to:
com.flutter.gradle.FlutterPlugin.addFlutterTasks(FlutterPlugin.kt:354)Technical Summary:
The
flutter-gradle-pluginis attempting to castApplicationExtensionImpl(the new AGP 9.1 DSL implementation) toAbstractAppExtension(a legacy internal AGP class). Since AGP 9.0+ has moved to a strict interface-based DSL, this legacy class no longer exists or is incompatible, causing the plugin to crash during the task-adding phase.This proves that Flutter 3.47.2 is currently broken for any project attempting to use the AGP 9.1.0 verified toolchain on Windows.
I am attaching the full verbose logs from the clean project for your review.
Reacted by Bruno Corona-
- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Sep 1, 2026 - addedplatform-androidAndroid applications specificallyAndroid applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-androidOwned by Android platform teamOwned by Android platform teamand removedin triagePresently being triaged by the triage teamPresently being triaged by the triage teamneeds repro infoAutomated crash report whose cause isn't yet knownAutomated crash report whose cause isn't yet known
on Sep 1, 2026 Hi @bahaa599599, thanks for the repro steps and for reproducing it again on a clean project with no third-party plugins.
Routing to the Android team for further investigation.Let's be clear, I'm still a beginner in Flutter programming. This is my first real project. I was programming normally until I updated Flutter and Gradle, and some problems arose that I hadn't encountered before. I tried using AI models to help me solve the problem, but they failed, and the application wouldn't build in any way. That's why I'm posting the problem here. After some attempts today, I managed to run the application, but I encountered one problem with a library that refused to work: cronet_http 1.9.0. So, I temporarily used HTTP instead. I will attach the latest Android file settings.
gradle.properties
android.useAndroidX=true android.newDsl=false android.builtInKotlin=false android.defaults.buildfeatures.resvalues=true android.sdk.defaultTargetSdkToCompileSdkIfUnset=truesettings.gradle.kts
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.1.0" apply false id("org.jetbrains.kotlin.android") version "2.4.0" apply false id("com.google.gms.google-services") version "4.4.2" apply false } include(":app")gradle-wrapper.properties
distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zipbuild.gradle.kts
repositories { google() mavenCentral() } } val newBuildDir: Directory = rootProject.layout.buildDirectory .dir("../../build") .get() rootProject.layout.buildDirectory.value(newBuildDir) subprojects { val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) project.layout.buildDirectory.value(newSubprojectBuildDir) afterEvaluate { if (project.hasProperty("android")) { val android = project.extensions.getByName("android") if (android is com.android.build.api.dsl.LibraryExtension) { if (android.namespace == null) { android.namespace = "com.generated.${project.name.replace(":", ".")}" } android.compileSdk = 36 } } } } subprojects { project.evaluationDependsOn(":app") } tasks.register<Delete>("clean") { delete(rootProject.layout.buildDirectory) }build.gradle.kts
id("com.android.application") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } android { namespace = "com.example.moon" compileSdk = 36 ndkVersion = flutter.ndkVersion compileOptions { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } defaultConfig { applicationId = "com.example.moon" minSdk = flutter.minSdkVersion targetSdk = 36 versionCode = flutter.versionCode versionName = flutter.versionName } buildTypes { release { signingConfig = signingConfigs.getByName("debug") } } dependencies {} } flutter { source = "../.." }The libraries I used in the project.
flutter: sdk: flutter flutter_localizations: sdk: flutter intl: ^0.20.3 l10n_currencies: ^2.0.3 flutter_bloc: ^9.1.1 flutter_screenutil: ^5.9.3 flutter_svg: ^2.3.0 internet_connection_checker: ^3.0.1 shared_preferences: ^2.5.5 shared_preferences_android: ^2.4.28 image_picker: ^1.2.3 image_cropper: ^12.2.1 pinput: ^6.0.2 cupertino_icons: ^1.0.9 firebase_core: ^4.14.0 firebase_auth: ^6.6.1 cloud_firestore: ^6.9.0 firebase_storage: ^13.5.0 firebase_app_check: ^0.4.7 freezed_annotation: ^3.1.0 json_annotation: ^4.12.0 carousel_slider: ^5.1.2 cached_network_image: ^4.0.0 collection: ^1.19.1 smooth_page_indicator: ^3.0.0 skeletonizer: ^2.1.3 infinite_scroll_pagination: ^5.1.1 device_preview: ^3.0.0 visibility_detector: ^0.4.0+2 flutter_map_cache: ^2.1.0 location_picker_flutter_map: ^4.1.0 country_picker: ^2.0.28 flutter_rating_bar: ^4.0.1 typesense: ^0.6.0 cloud_functions: ^6.4.0 fluttertoast: ^10.0.0 go_router: ^18.0.0 flutter_cache_manager: ^3.4.2 http: ^1.6.0 path_provider: ^2.1.6 http_cache_hive_store: ^5.1.1 path: ^1.9.1 dependency_overrides: # cronet_http: ^1.9.0 # cupertino_http: ^3.0.2 dev_dependencies: flutter_test: sdk: flutter build_runner: ^2.16.0 freezed: ^4.0.0 json_serializable: ^6.14.1 geolocator_android: ^5.0.3 flutter_lints: ^6.0.0 very_good_analysis: ^10.3.0Regarding the cronet_http library: ^1.9.0, it caused the application to fail completely when it was in dependencies. If it was in dependency_overrides, the application would be built, but you would not be able to download images from firebase.
I don't see the stacktrace you indicate in your verbose logs.
Also
KOTLIN VERSION VALIDATION ERROR:
Flutter fails to recognize the built-in Kotlin version, reporting: 'Your project's Kotlin version (2.2.10) is lower than Flutter's minimum supported version of 2.2.20', even when KGP 2.4.0 is defined.This makes me think what you're actually hitting is #192167
Can you try passing
--android-skip-build-dependency-validationto your build?Otherwise can you include a version of the verbose logs which includes the stacktrace you mention?
- addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Sep 8, 2026 - added a commit that references this issue
on Sep 11, 2026 - addedtriaged-androidTriaged by Android platform teamTriaged by Android platform team
on Sep 15, 2026 This issue is missing a priority label. Please set a priority label when adding the
triaged-androidlabel.- removedtriaged-androidTriaged by Android platform teamTriaged by Android platform team
on Sep 15, 2026 I can reproduce a related Android build failure on Windows with a minimal Flutter app that has no native plugins.
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. Cannot query the value of this provider because it has no value available.My tests:
- Windows 11
- Flutter stable 3.47.4 / Dart 3.13.3
- Also tested Flutter 3.38.10 / Dart 3.10.9 in a separate toolchain
- Android SDK platform 37.0 and build-tools 36.0.0
- Microsoft OpenJDK 17 and Android Studio's bundled JBR
- A newly created Flutter app with no native plugins
- Cleared Gradle cache/daemons, used an isolated Gradle user home, and reinstalled the Android platform/build tools
- Also tested AGP 8.11.1, Kotlin 2.2.20, and Gradle 8.14
Every test fails during
assembleDebugwith the same provider error. Web builds work correctly.Is this likely related to the Flutter Gradle-plugin/AGP compatibility problem being tracked here, or should I open a separate focused issue with a minimal reproduction?
- addedtriaged-androidTriaged by Android platform teamTriaged by Android platform teamand removedtriaged-androidTriaged by Android platform teamTriaged by Android platform team
on Sep 22, 2026 @umerbashir-del I think your case may be a different issue. Can you create a new issue and provide a minimal reproducible sample? Also, let's make sure you are using openJDK 17. Make sure OpenJDK 17 is downloaded and exists on your machine then run
flutter config --jdk-dir="<path/to/java/binary>". Try buildling your flutter app again.Update: I followed the requested OpenJDK 17 check and retested with a minimal Flutter project on Windows.
- Flutter 3.47.4
- Microsoft OpenJDK 17.0.20, configured with
flutter config --jdk-dir - Android SDK command-line tools installed; licenses accepted
- Android SDK platform 37 / build-tools 36.0.0
- Gradle 8.14, AGP 8.11.1, Kotlin 2.2.20
The initial build was blocked because NDK
28.2.13676358was not installed. After installing that exact NDK version,flutter build apk -vcompleted successfully and produced the release APK.I can no longer reproduce the original provider error with this minimal setup, so I will not open a separate issue at this time.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.
Steps to reproduce
android.newDsl=true
android.builtInKotlin=true
Expected results
The Flutter build system should successfully orchestrate the build using AGP 9.1.0. It should handle the new Built-in Kotlin compilation model without conflict, correctly resolve task dependencies for sub-modules (like JNI), and successfully initialize internal Gradle services (AndroidLocationsBuildService) on the Windows file system.
Actual results
The project encountered a series of critical failures that prevent any successful build:
SERVICE CREATION FAILURE (Final Blocker):
'Failed to create service AndroidLocationsBuildService'. The 'AndroidDirectoryCreator' fails to provide a value for 'android.home', preventing the application of 'com.android.application'.
DSL & CLASS CAST EXCEPTION:
When 'android.newDsl=true', the Flutter Gradle plugin fails with 'java.lang.ClassCastException: ...ApplicationExtensionImpl cannot be cast to ...AbstractAppExtension', as it relies on legacy internal classes removed in AGP 9.0+.
CIRCULAR EVALUATION:
Gradle 9.3.1 reports 'Circular evaluation detected' when setting 'rootProject.layout.buildDirectory' using standard Flutter template logic. Manual override to 'layout.projectDirectory' was required.
KOTLIN VERSION VALIDATION ERROR:
Flutter fails to recognize the built-in Kotlin version, reporting: 'Your project's Kotlin version (2.2.10) is lower than Flutter's minimum supported version of 2.2.20', even when KGP 2.4.0 is defined.
DSL NAME COLLISION (Kotlin DSL):
'signingConfig = signingConfigs.debug' fails with 'Assignment type mismatch' because 'debug' is shadowed by 'NamedDomainObjectProvider'. Requires 'signingConfigs.getByName("debug")'.
JNI PROVIDER FAILURE:
The task ':jni:compileDebugJavaWithJavac' fails with 'Cannot query the value of this provider because it has no value available', indicating that AGP 9.1.0 is not correctly propagating version providers to sub-modules.
SDK 37 TOOLING MISMATCH:
'flutter doctor' reports 'Android license status unknown', while the Android SDK 37 CLI reports that the '--licenses' flag is deprecated/removed.
The following plugins are directly involved in the failures or warnings:
Code sample
val sdkDir = localProperties.getProperty("sdk.dir")
if (sdkDir != null) {
System.setProperty("android.home", file(sdkDir).absolutePath)
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "9.1.0" apply false
id("com.google.gms.google-services") version "4.4.2" apply false
}
/////////////////////////////////////////
android {
namespace = "com.example.moon"
compileSdk = 36
buildToolsVersion = "36.0.0"
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
FAILURE: Build failed with an exception.
An exception occurred applying plugin request [id: 'com.android.application']
Flutter Doctor output
Doctor output