-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Add documentation for migrating Android build files to declarative form #135392
Comments
It might've been more helpful to have the docs outlining the migration or at least some guidance in the templates themselves prior to having this pushed out. I think it pre-dates this commit, but having the flutter gradle plugin identifer as |
That's right. In general, I think the topic you're talking about deserves a separate issue. |
Also pay attention to #54566 which still is used and needs migration for previous versions since v |
@bartekpacia plugins {
id 'com.android.application'
id 'kotlin-android'
id 'dev.flutter.flutter-gradle-plugin'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'com.google.firebase.firebase-perf'
} |
@asaarnak Glad to hear that! In
It's not needed at all. Just saying in case you have it in your project:) |
@bartekpacia Our settings.gradle root plugins block looks like this: plugins {
id 'dev.flutter.flutter-plugin-loader' version '1.0.0'
id 'com.android.application' version '8.3.0-alpha14' apply false
id 'org.jetbrains.kotlin.android' version '1.9.21' apply false
id 'com.google.gms.google-services' version '4.4.0' apply false
id 'com.google.firebase.crashlytics' version '2.9.9' apply false
id 'com.google.firebase.firebase-perf' version '1.4.2' apply false
} |
This PR adds a guide explaining how to migrate from _imperative apply_ of Flutter's Gradle plugins to _declarative apply_. Resolves flutter/flutter#135392 ## Presubmit checklist - [x] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer. ## Preview [here](https://flutter-docs-prod--pr9857-migration-guide-gradle-plugi-vyllekcb.web.app/release/breaking-changes/flutter-gradle-plugin-apply) --------- Co-authored-by: Anthony Sansone <atsansone@users.noreply.github.com> Co-authored-by: Gustl22 <git@reb0.org>
This PR adds a guide explaining how to migrate from _imperative apply_ of Flutter's Gradle plugins to _declarative apply_. Resolves flutter/flutter#135392 ## Presubmit checklist - [x] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer. ## Preview [here](https://flutter-docs-prod--pr9857-migration-guide-gradle-plugi-vyllekcb.web.app/release/breaking-changes/flutter-gradle-plugin-apply) --------- Co-authored-by: Anthony Sansone <atsansone@users.noreply.github.com> Co-authored-by: Gustl22 <git@reb0.org>
…ethod" way (#139690) This PR adds a deprecation message when Android build is using the legacy "apply script method" way of applying Flutter's Gradle plugins (that is: [`flutter.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/flutter.gradle) and [`app_plugin_loader.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/app_plugin_loader.gradle)). See also: - #121541 - in particular #121541 (comment) - #135392 - and PR that add the migration guide: [#9857](flutter/website#9857) - I think either `logger.error` or `logger.quiet` must be used, because all other error levels are not shown during `flutter build apk` (and that's what most people use).
… script method" way" (#140102) Reverts #139690 Initiated by: hellohuanlin This change reverts the following previous change: Original Description: This PR adds a deprecation message when Android build is using the legacy "apply script method" way of applying Flutter's Gradle plugins (that is: [`flutter.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/flutter.gradle) and [`app_plugin_loader.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/app_plugin_loader.gradle)). See also: - #121541 - in particular #121541 (comment) - #135392 - and PR that add the migration guide: [#9857](flutter/website#9857) - I think either `logger.error` or `logger.quiet` must be used, because all other error levels are not shown during `flutter build apk` (and that's what most people use).
…ethod" way (flutter#139690) This PR adds a deprecation message when Android build is using the legacy "apply script method" way of applying Flutter's Gradle plugins (that is: [`flutter.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/flutter.gradle) and [`app_plugin_loader.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/app_plugin_loader.gradle)). See also: - flutter#121541 - in particular flutter#121541 (comment) - flutter#135392 - and PR that add the migration guide: [flutter#9857](flutter/website#9857) - I think either `logger.error` or `logger.quiet` must be used, because all other error levels are not shown during `flutter build apk` (and that's what most people use).
…cript method (#140103) > This PR relands #139690 which was reverted in #140102 This PR adds a deprecation message when Android build is using the legacy "apply script method" way of applying Flutter's Gradle plugins (that is: [`flutter.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/flutter.gradle) and [`app_plugin_loader.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/app_plugin_loader.gradle)). See also: - #121541 - in particular #121541 (comment) - #135392 - and PR that add the migration guide: [#9857](flutter/website#9857) - I think either `logger.error` or `logger.quiet` must be used, because all other error levels are not shown during `flutter build apk` (and that's what most people use).
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
To whoever reads this issue in a future: if you encounter any problems while migrating, please create a new issue or ask on StackOverflow. Thanks! |
Overview
Gradle files in the
android
directory of a Flutter app proejct were recently refactored. This work is discussed in much more detail in the following issues (and respective PRs that fixed them):plugins {}
block, rather than imperativeapply
#125009New
flutter create
d apps will use the updated buildscript templates automatically. Existing apps aren't migrated though. Doing so automatically (using the tool's Migrator API) would be hard to do and error prone, and even then it would only work for projects that didn't substantially modify the buildscripts (which most apps do at some point).This issue is about writing a migration guide where all these changes would be explained, so developers could easily update the native buildscripts.
Changes
Below is a summary of what default Gradle build files look like in a few latest Flutter versions. They're taken from the default app generated with
flutter create example
.A migration guide should take into account that different apps were generated with different versions of Flutter.
Flutter 3.10
Released on May 10th, 2023.
Gradle build files didn't change much (at all) in previous Flutter versions.
android/settings.gradle
android/build.gradle
android/app/build.gradle
Flutter 3.13
Released on August 16th, 2023.
android/settings.gradle
android/build.gradle
android/app/build.gradle
Flutter 3.16
Released on November 15th, 2023.
android/settings.gradle
android/build.gradle
android/app/build.gradle
Flutter 3.19
Released on February 15th, 2024.
android/settings.gradle
android/build.gradle
android/app/build.gradle
Future changes
I'll do my best to keep this issue updated.
The text was updated successfully, but these errors were encountered: