-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to Reproduce
-
flutter createa simple app -
Run a debug Gradle build in the
androiddirectory$ ./gradlew :app:tasks
Expected results:
I expect no tasks to be created immediately, to follow Gradle's best practices (Task Configuration Avoidance in this case).
Tasks such as compileFlutterBuildRelease or packBuildsFlutterLibRelease sound like they should only be configured when building an app in release mode, but instead, they're created in every Gradle build.
These tasks are registered in flutter.gradle. According to Gradle, the lazy project.tasks.register() method should be used instead of the eager project.tasks.create() method.
Actual results:
Some tasks are created immediately on every Gradle invocation (so basically every time someone flutter runs on Android).
How to see what tasks are created immediately in Gradle?
Use Build Scans. To create a scan for the Gradle build:
$ ./gradlew :app:tasks --scanSee an example Build Scan demonstrating this: link.
Logs
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-arm, locale en-PL)
• Flutter version 3.3.10 on channel stable at /Users/bartek/fvm/versions/3.3.10
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (6 weeks ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/bartek/androidsdk
• Platform android-33, build-tools 33.0.1
• ANDROID_HOME = /Users/bartek/androidsdk
• Java binary at: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2022.1)
• Android Studio at /Users/bartek/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
• IntelliJ at /Users/bartek/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin version 71.3.6
• Dart plugin version 223.8214.16
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
• IntelliJ at /Users/bartek/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/223.8214.52/IntelliJ IDEA.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.74.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C65 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
