错误:指定的语言版本过高.支持的最高语言版本是2.8.在android studio中该如何解决?

错误:指定的语言版本过高.支持的最高语言版本是2.8.在android studio中该如何解决?

问题描述:

切换到分支稳定"颤振通道后

After switched to branch 'stable' flutter channel

以下是构建问题.

错误:指定的语言版本过高.支持的最高语言版本是2.8.

Error: The specified language version is too high. The highest supported language version is 2.8.

output: ../../third_party/dart/third_party/pkg/collection/lib/src/utils.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.8.
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
^
../../third_party/dart/third_party/pkg/collection/lib/src/wrappers.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.8.
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
^
../../third_party/dart/third_party/pkg/collection/lib/src/functions.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.8.
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
^

为什么?

之所以会这样,是因为您指定的语言版本高于在 .dart_tool 目录(特别是在 package_config.json 文件中)中声明的版本.

Why?

This happens, because the your specified language version is higher than the one declared in the .dart_tool directory (specifically in the package_config.json file).

您可以手动删除文件夹,也可以让Flutter工具为您完成此操作.从终端运行 flutter clean ,或者,如果使用的是Android Studio,请转到 Tools->颤动->Flutter Clean .

You can either delete the folder manually or let Flutter tools do it for you. Run flutter clean from the terminal or, if using Android Studio, go to Tools -> Flutter -> Flutter Clean.