“无法获取 FlutterExtension 类型的扩展‘flutter’的未知属性‘ndkVersion’”

ale*_*omo 14 dart flutter

我对 Flutter 和 Dart 非常陌生,在尝试编译我的项目时出现以下错误:

FAILURE: Build failed with an exception.

* Where:

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'ndkVersion' for extension 'flutter' of type FlutterExtension.
* 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 2s
Run Code Online (Sandbox Code Playgroud)

我能做什么来解决这个问题?

我正在使用 Visual Studo Code,刚刚从 Git 全新安装了 Flutter,已经尝试过

flutter clean
Run Code Online (Sandbox Code Playgroud)

flutter upgrade
Run Code Online (Sandbox Code Playgroud)

但似乎没有任何作用

提前致谢,祝您有美好的一天。

小智 15

进入 android>app>build.gradle 并将 flutter.ndkVersion 更改为最新的稳定版本。您可以在这里查看最新的 ndk 稳定版本:https ://developer.android.com/ndk/downloads

你从这里开始:之前

对此:之后