sossoldi
sossoldi copied to clipboard
Update Flutter Gradle plugin configuration
Summary
This pull request addresses deprecation warnings related to the use of Flutter's Gradle plugins. Specifically, it updates the Gradle configuration files to replace the imperative apply
script method with the declarative plugins
block.
Issue
When running flutter run
, the following deprecation warnings were encountered:
Launching lib/main.dart on CPH2211 in debug mode...
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-apply
You 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
References
According with the Flutter documentation this PR apply the new plugin configuration method.
Changes Made
The following changes have been made to address the deprecation warnings:
-
Updated
android/app/build.gradle
:- Replaced
apply plugin:
statements with theplugins { id: }
block. - Removed the obsolete
apply from
statement.
- Replaced
-
Updated
android/build.gradle
:- Removed the outdated
buildscript
block and migrated to the new plugin management system.
- Removed the outdated
-
Updated
android/settings.gradle
:- Added
pluginManagement
block to specify plugin versions and repositories. - Used the
plugins
block for plugin configuration instead ofapply from
.
- Added
These changes align with the latest Flutter Gradle plugin requirements and ensure compatibility with future releases.
Testing
The updates have been tested with the flutter run
command to verify that the deprecation warnings are resolved and the application builds successfully.
Please review and merge this PR to ensure compatibility with the latest Flutter Gradle plugin standards.