Key takeaways
- Flutter 3.16 added support for applying its Gradle plugins with the declarative plugins {} block, and Flutter 3.19 made it the recommended way. Projects created before 3.16 have to be migrated by hand.
- Flutter removed support for the old apply from: flutter.gradle method in pull request #160947, merged January 7, 2025. Flutter 3.29.0, released February 12, 2025, is the first stable release that includes it.
- The build now stops with "You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is not possible anymore." A similar message names the app_plugin_loader plugin when settings.gradle uses the old method.
- The fix touches three files: android/settings.gradle gets a pluginManagement and plugins block, android/build.gradle loses its buildscript block, and android/app/build.gradle swaps its apply lines for a plugins block.
- Firebase projects also move the Google Services and Crashlytics Gradle plugins out of buildscript and into the same plugins blocks.
Pricing an app? Try the free app cost calculator or get a range for your project in the instant quote.
If an Android build fails with "You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is not possible anymore", your Gradle files still load Flutter the pre-3.16 way. Flutter 3.29 removed support for that method, so the old flutter.gradle file now does nothing but throw this error. The fix is to move three Gradle files to the declarative plugins {} block. It changes how the build is wired, not your app's code.
If you landed here from the link in the error message, flutter.dev/to/flutter-gradle-plugin-apply, it still opens Flutter's migration page. This guide follows that page and adds what the page doesn't say: when the old method stopped working, and the Firebase case most older apps have. The facts come from Flutter's docs, its source code and its release archive, as listed in the sources. I checked each one on October 18, 2026.
Disclosure: App369 is my studio. I build and fix Flutter apps, and the last section mentions what I sell. Google doesn't pay me for anything on this page.
What changed, and when
| Date | What happened | Source |
|---|---|---|
| November 15, 2023 | Flutter 3.16 adds support for the declarative plugins {} block. New flutter create projects use it | Flutter docs, release archive |
| February 15, 2024 | Flutter 3.19: the declarative block is the recommended way | Flutter docs, release archive |
| January 7, 2025 | Pull request #160947 removes support for the imperative apply | Flutter PR #160947 |
| February 12, 2025 | Flutter 3.29.0, the first stable release that includes that change | Release archive, Flutter PR #160947 |
Flutter's docs page lists only when the new method was supported and recommended. The removal date comes from the pull request. I checked that its commit is in the 3.29.0 tag and not in 3.27.
The two versions of the error
Both come from files in Flutter's own Gradle folder that now exist only to throw an error:
flutter.gradle: "You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is not possible anymore." This meansandroid/app/build.gradlestill hasapply from: ".../flutter.gradle".app_plugin_loader.gradle: "You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is not possible anymore." This meansandroid/settings.gradlestill loads the plugin loader the old way.
Both point to the same migration page, and the fix below covers both.
The fix, file by file
These steps follow Flutter's migration page. My advice: commit or back up the android folder before you start, so you can compare.
1. Note your AGP and Kotlin versions
Open android/build.gradle. In the buildscript block, the Android Gradle Plugin version is the number at the end of classpath 'com.android.tools.build:gradle:...', and the Kotlin version is in ext.kotlin_version = '...'. You need both in the next step.
2. Replace android/settings.gradle
Flutter's page gives this as the new contents. Replace {agpVersion} and {kotlinVersion} with the versions from step 1:
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return 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 "{agpVersion}" apply false
id "org.jetbrains.kotlin.android" version "{kotlinVersion}" apply false
}
include ":app"
If you had your own code in this file, keep it after the pluginManagement {} and plugins {} blocks. Gradle doesn't allow other code before them. The plugin loader must not be set to apply false.
3. Remove buildscript from android/build.gradle
Delete the whole buildscript { ... } block. The allprojects, subprojects and clean parts stay.
4. Update android/app/build.gradle
Remove the def flutterRoot = localProperties.getProperty('flutter.sdk') line and the if (flutterRoot == null) { throw ... } block that follows it. Keep the code that loads local.properties, which the version settings still use. Then remove the old apply lines. In Flutter 3.10's flutter create template they look like this:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Then add this at the very top of the file:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
Flutter's page points out that dev.flutter.flutter-gradle-plugin here is a different ID from dev.flutter.flutter-plugin-loader in settings.gradle. If the dependencies block has org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version, remove that line.
5. Build and run
Flutter's page says to run flutter run and check that the app builds and launches on an Android device or emulator.
If the app uses Firebase
If your app uses Firebase, its Google Services plugin, and Crashlytics if you use it, are probably applied the old way too. Flutter's page covers this case:
- In
android/build.gradle, remove theclasspathlines forcom.google.gms:google-servicesandcom.google.firebase:firebase-crashlytics-gradle. Note their versions first. - In
android/app/build.gradle, removeapply plugin: 'com.google.gms.google-services'andapply plugin: 'com.google.firebase.crashlytics'. - Add both to the
pluginsblock inandroid/settings.gradle, with the versions you noted andapply false:id "com.google.gms.google-services" version "4.4.0" apply false id "com.google.firebase.crashlytics" version "2.9.9" apply false - Add
id "com.google.gms.google-services"andid "com.google.firebase.crashlytics"to thepluginsblock inandroid/app/build.gradle, without versions.
The versions above are the ones in Flutter's example. Use the versions your project had, or newer ones.
If the build still fails after this
In my view, a project old enough to hit this error usually has more than one problem waiting: old plugins, an old AGP or Gradle version, or the v1 embedding. If the next error says "Build failed due to use of deleted Android v1 embedding", see the v1 embedding fix, also removed in Flutter 3.29. If Gradle can't find jcenter(), see the JCenter guide.
Need a hand?
If an older Flutter app won't build after an upgrade, the App Fix Ticket covers it in two fixed-price steps. A $450 Diagnosis gives you the root cause with evidence and a fixed repair quote within 3 business days, credited toward the fix. If you go ahead, the $1,200 Fix takes 5 business days and comes as a pull request. Or send me a short description.
Frequently asked questions
- What does "applying Flutter's main Gradle plugin imperatively" mean?
- Your android/app/build.gradle still loads Flutter's Gradle plugin with apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle". Flutter removed support for that method, and in Flutter 3.29 and later that file only throws this error. The fix is to apply the plugin with the declarative plugins {} block.
- Which Flutter version made the imperative apply an error?
- Flutter 3.29. The change that removed support, Flutter pull request #160947, was merged on January 7, 2025 and is included in the 3.29.0 tag but not in 3.27. Flutter's release archive dates 3.29.0 February 12, 2025.
- How do I fix the error?
- Follow Flutter's "Deprecated imperative apply of Flutter's Gradle plugins" page: put a pluginManagement block and a plugins block with dev.flutter.flutter-plugin-loader in android/settings.gradle, remove the buildscript block from android/build.gradle, and replace the apply lines in android/app/build.gradle with a plugins block that includes dev.flutter.flutter-gradle-plugin.
- What is the difference between flutter-plugin-loader and flutter-gradle-plugin?
- Flutter's docs say dev.flutter.flutter-plugin-loader is the settings plugin and goes in settings.gradle, while dev.flutter.flutter-gradle-plugin is the project plugin and goes in app/build.gradle. They are different IDs, and the loader must not be set to apply false.
- What about google-services and Crashlytics?
- Flutter's docs show removing their classpath lines from android/build.gradle and their apply plugin lines from app/build.gradle, then adding com.google.gms.google-services and com.google.firebase.crashlytics with versions and apply false to the settings.gradle plugins block, and without versions to the app/build.gradle plugins block.
Sources
- Flutter docs, Deprecated imperative apply of Flutter's Gradle plugins (last updated July 31, 2026)
- Flutter on GitHub, pull request #160947 "Remove support for imperative apply of Flutter Gradle Plugin"
- Flutter on GitHub, flutter_tools gradle/flutter.gradle
- Flutter on GitHub, flutter_tools gradle/app_plugin_loader.gradle
- Flutter on GitHub, Flutter 3.10.0 app/build.gradle template
- Flutter release archive (macOS)
Fixed-price services
Want this done at a fixed price?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
Related Resources
Related guides
Flutter "Deleted Android v1 Embedding" Build Error: The Fix
Flutter removed the Android v1 embedding in Flutter 3.29 (February 12, 2025), so older projects now stop with "Build failed due to use of deleted Android v1 embedding" or a plugin error about PluginRegistry.Registrar. What the error means, how Flutter decides your app is v1, and the exact AndroidManifest and MainActivity changes, from Flutter's docs and source checked October 18, 2026.
Read moreJCenter Shutdown: Fixing Old Android and Flutter Builds
Bintray shut down on May 1, 2021, JCenter has redirected to Maven Central since August 15, 2024, and Gradle 9 removed jcenter(). How to fix an old Android or Flutter build that still points at them, with every address checked on October 18, 2026.
Read moreFlutter iOS Build Failed After an Upgrade? Fix CocoaPods and Xcode Errors (2026)
Flutter iOS build failing after upgrading Flutter, FlutterFire or Xcode? How to read the real error, then fix CocoaPods, deployment target and plugin version mismatches.
Read more