Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Flutter warns that the Gradle plugin is applied the old imperative way

ErrorApplying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method is deprecated

Short 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.

  • Applies to Flutter 3.x, Gradle 8, Android Gradle Plugin 8.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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.gradle
  2. 2Match what you see, then jump to its fix

    1. 1Lines that read the Flutter SDK path and call apply from in android/settings.gradlesettings.gradle still uses the old include and apply linesFix
    2. 2apply plugin lines and apply from with flutter.gradle in the app moduleandroid/app/build.gradle applies the plugins with apply linesFix
    3. 3A buildscript block with ext.kotlin_version in the root android/build.gradleandroid/build.gradle still has the buildscript blockFix
    4. 4classpath lines for google-services or firebase-crashlytics-gradle, or apply plugin lines for themGoogle services or Crashlytics plugins are still on the old classpathFix

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.gradle

2Fix

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 projects

Confirmed by docs.flutter.dev

Did this fix it?

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.gradle

2Fix

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 run

Confirmed by docs.flutter.dev

Did this fix it?

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.gradle

2Fix

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 --debug

Confirmed by docs.flutter.dev

Did this fix it?

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.gradle

2Fix

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 run

Confirmed by docs.flutter.dev

Did this fix it?

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:

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.