将 flutter 升级到版本 3 后,我现有的项目无法构建

GNa*_*sro 8 android gradle flutter

我正在使用 flutter 2.10.0 版本进行项目,它工作正常,但是将 flutter 升级到 3.0.0 版本后,我的项目未构建,它给了我这个错误

[        ] > Task :app:compileFlutterBuildDebug FAILED
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 1 actionable task: 1 executed
[        ] FAILURE: Build failed with an exception.
[        ] * Where:
[        ] Script '/home/user/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
[        ] * What went wrong:
[        ] Execution failed for task ':app:compileFlutterBuildDebug'.
[        ] > Process 'command '/home/user/snap/flutter/common/flutter/bin/flutter'' finished with non-zero exit value 1
[        ] * Try:
[        ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 18s
[ +550 ms] Exception: Gradle task assembleDebug failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

小智 5

这篇博文可能会帮助您:

如果您使用 Flutter 工具创建新项目,您可能会注意到生成的文件现在使用最新版本的 Gradle 和 Android Gradle 插件。对于现有项目,您需要手动将 Gradle 版本升级到 7.4,将 Android Gradle 插件版本升级到 7.1.2。