Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Flutter Gradle plugin configuration #171

Merged

Conversation

gioisco
Copy link
Contributor

@gioisco gioisco commented Aug 13, 2024

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:

  1. Updated android/app/build.gradle:

    • Replaced apply plugin: statements with the plugins { id: } block.
    • Removed the obsolete apply from statement.
  2. Updated android/build.gradle:

    • Removed the outdated buildscript block and migrated to the new plugin management system.
  3. Updated android/settings.gradle:

    • Added pluginManagement block to specify plugin versions and repositories.
    • Used the plugins block for plugin configuration instead of apply from.

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.

Updated the Gradle plugin configuration in the following files to comply with
recent changes in Flutter's Gradle plugin:

- `android/app/build.gradle`
- `android/build.gradle`
- `android/settings.gradle`

Changes include:
- Replaced `apply plugin:` with `plugins { id: }` as per Flutter's updated
  guidelines.
- Adjusted the configuration to ensure compatibility with the latest Flutter
  Gradle plugin requirements.

Refer to the Flutter breaking change documentation for more details:
https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply

These updates are necessary to maintain build compatibility with the latest
version of Flutter.
@gioisco gioisco changed the title fix: update Flutter Gradle plugin configuration Update Flutter Gradle plugin configuration Aug 15, 2024
@mikev-cw
Copy link
Collaborator

mikev-cw commented Sep 3, 2024

Looks good to me, it just works as expected! 👍🏻

@lucaantonelli lucaantonelli merged commit 5afebcf into RIP-Comm:main Nov 3, 2024
1 check passed
@gioisco gioisco deleted the chore/update-flutter-gradle-plugin branch November 27, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants