After Upgrading the Flutter version to 3.19.0
I am getting this warning when running the app:
You are applying Flutter’s app_plugin_loader Gradle plugin
imperatively using the apply script method, which is deprecated and
will be removed in a future release. Migrate to applying Gradle
plugins with the declarative plugins block:
https://flutter.dev/go/flutter-gradle-plugin-applyYou are applying Flutter’s main Gradle plugin imperatively using the
apply script method, which is deprecated and will be removed in a
future release. Migrate to applying Gradle plugins with the
declarative plugins block:
https://flutter.dev/go/flutter-gradle-plugin-apply
How to remove these deprecated gradle settings.
2
Answers
It is necessary to migrate the project if it was created on an older version. Here are the instructions: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply.
Since Flutter 3.16, projects generated with flutter create use the Plugin DSL to apply Gradle plugins. Projects created with versions of Flutter prior to 3.16 need to be migrated manually.
To Follow The steps:
Step one :
Replace the contents of /android/settings.gradle with the below
Moving (Plugins) Section to new Below one Out of pluginManagement curly Brackets
Add this Section to pluginManagement Below Line >>
Step Two:
Remove the whole buildscript block from <app-src/android/build.gradle:
Step Three:
Remove this code if it’s found from <app-src/android/build.gradle:
Last Step : in the same file at first line add this code :
Finally You can follow instructions From Flutter Docs:
Deprecated imperative apply of Flutter’s Gradle plugins