Flutter warns that the Gradle plugin is applied the old imperative way
Applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method is deprecatedShort answer
The warning means your android folder still loads the Flutter Gradle plugin with apply from or apply plugin lines. Flutter's migration replaces them with a plugins block: dev.flutter.flutter-plugin-loader in settings.gradle and dev.flutter.flutter-gradle-plugin in app/build.gradle. Edit three files, then run the app.
Fix it fast
1Find out which cause you have
Search the android folder for the old lines. Every hit is something the migration removes.
grep -rn "apply plugin\|apply from\|buildscript" android/settings.gradle android/build.gradle android/app/build.gradle2Match what you see, then jump to its fix
- 1
Lines that read the Flutter SDK path and call apply from in android/settings.gradlesettings.gradle still uses the old include and apply linesFix - 2
apply plugin lines and apply from with flutter.gradle in the app moduleandroid/app/build.gradle applies the plugins with apply linesFix - 3
A buildscript block with ext.kotlin_version in the root android/build.gradleandroid/build.gradle still has the buildscript blockFix - 4
classpath lines for google-services or firebase-crashlytics-gradle, or apply plugin lines for themGoogle services or Crashlytics plugins are still on the old classpathFix
- 1
What does the error look like?
Applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method is deprecated
Cause 1 of 4
settings.gradle still uses the old include and apply lines
1Check
A migrated file starts with a pluginManagement block and a plugins block. Anything else before them is old style.
head -30 android/settings.gradle2Fix
Replace the file with the declarative form. The settings plugin is dev.flutter.flutter-plugin-loader and must not be set to apply false. Put your own additions after pluginManagement and plugins, because Gradle allows no other code before them. Use your own AGP and Kotlin versions in place of the placeholders.
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"3Verify
Run a Gradle task from the android folder and confirm the settings file loads.
cd android && ./gradlew projectsConfirmed by docs.flutter.dev
Cause 2 of 4
android/app/build.gradle applies the plugins with apply lines
1Check
Look for the apply from line that points at flutter.gradle inside the Flutter SDK.
grep -n "flutter.gradle\|apply plugin" android/app/build.gradle2Fix
Delete the flutterRoot check and the apply plugin and apply from lines. Add a plugins block at the very top of the file. dev.flutter.flutter-gradle-plugin is the app-level plugin and is a different ID from the settings plugin.
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}3Verify
Run the app.
flutter runConfirmed by docs.flutter.dev
Cause 3 of 4
android/build.gradle still has the buildscript block
1Check
The Kotlin classpath now comes from the plugins block in settings.gradle, so the root buildscript block is left over.
grep -n "buildscript\|kotlin_version" android/build.gradle android/app/build.gradle2Fix
Delete the whole buildscript block from android/build.gradle. If app/build.gradle has a kotlin-stdlib-jdk7 dependency that uses kotlin_version, remove that line too.
// delete from android/build.gradle:
buildscript {
ext.kotlin_version = '{kotlinVersion}'
...
}3Verify
Build again and check that the warning is gone.
flutter build apk --debugConfirmed by docs.flutter.dev
Cause 4 of 4
Google services or Crashlytics plugins are still on the old classpath
1Check
These two plugins moved as well.
grep -rn "google-services\|crashlytics" android/build.gradle android/app/build.gradle android/settings.gradle2Fix
Remove their classpath lines and apply plugin lines. Declare them in settings.gradle with apply false, and in app/build.gradle without it.
// android/settings.gradle plugins block
id "com.google.gms.google-services" version "4.4.0" apply false
id "com.google.firebase.crashlytics" version "2.9.9" apply false
// android/app/build.gradle plugins block
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"3Verify
Run the app and open a Firebase feature.
flutter runConfirmed by docs.flutter.dev
How do I stop it coming back?
- Create new projects with the current flutter create, which already uses the declarative form.
- Keep all Gradle changes after the pluginManagement and plugins blocks in settings.gradle.
- Run flutter run after each of the three file edits, not only at the end.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
Related fixes
Mobile apps
Google Play says the app does not support 16 KB memory pages
check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a
Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.
5 causes, each with a fixMobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
Gradle cannot create LibraryVariantBuilderImpl in a Flutter Android build
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl
This error appears when the Android Gradle plugin (AGP) cannot run in the Gradle or IDE you use.
3 causes, each with a fixMobile apps
Flutter release build cannot open the keystore: HmacPBESHA256 not available
Algorithm HmacPBESHA256 not available
The keystore is a PKCS12 file protected by a newer algorithm than the Java that is reading it understands.
3 causes, each with a fixMobile apps
Android install error: the package conflicts with an existing package of the same name
The package conflicts with an existing package by the same name
Android allows only one app per application ID, and an update must be signed with the same certificate as the installed version.
3 causes, each with a fixMobile apps
Android resource linking fails with resource android:attr/lStar not found
error: failed linking references.
The lStar attribute exists only from Android API 31.
2 causes, each with a fix