不良状态:意外诊断:颤振升级到 1.20.1 后

Posted

技术标签:

【中文标题】不良状态:意外诊断:颤振升级到 1.20.1 后【英文标题】:Bad state: Unexpected diagnostics: after flutter upgrade to 1.20.1 【发布时间】:2020-12-02 00:44:30 【问题描述】:

有什么问题?

xxx@xxx-Inspiron-14-3467:~/xxx$ flutter pub run build_runner build[INFO] Generating build script...
[INFO] Generating build script completed, took 406ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 14.6s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 773ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] chopper_generator:chopper_generator on test/widget_test.dart:

Bad state: Unexpected diagnostics:
/home/xxx/Desktop/flutter_linux_1.20.1-stable/flutter/bin/cache/dart-sdk/lib/core/uri.dart:3259:39 - Expected an identifier.
[SEVERE] chopper_generator:chopper_generator on test/widget_test.dart:

Bad state: Unexpected diagnostics:
/home/xxx/Desktop/flutter_linux_1.20.1-stable/flutter/bin/cache/dart-sdk/lib/core/uri.dart:3259:39 - Expected an identifier.
[INFO] 1.6s elapsed, 1/17 actions completed.
[INFO] 2.7s elapsed, 1/17 actions completed.
[INFO] 3.8s elapsed, 1/17 actions completed.
[INFO] 4.9s elapsed, 1/17 actions completed.
[INFO] 6.0s elapsed, 1/17 actions completed.
[INFO] 7.1s elapsed, 1/17 actions completed.
[INFO] 8.2s elapsed, 1/17 actions completed.
[INFO] 9.3s elapsed, 1/17 actions completed.
[INFO] 10.4s elapsed, 1/17 actions completed.
[INFO] 11.5s elapsed, 1/17 actions completed.
[INFO] 12.6s elapsed, 1/17 actions completed.
[INFO] 13.7s elapsed, 1/17 actions completed.
[INFO] 14.8s elapsed, 1/17 actions completed.
[WARNING] No actions completed for 15.1s, waiting on:
  - chopper_generator:chopper_generator on lib/repository/model/radio_model.dart
  - chopper_generator:chopper_generator on lib/repository/model/xxx.dart
  - chopper_generator:chopper_generator on lib/repository/model/time.dart
  - chopper_generator:chopper_generator on lib/repository/model/assign_to.dart
  - chopper_generator:chopper_generator on lib/repository/model/defect_cases_count.dart
  .. and 11 more

【问题讨论】:

github.com/flutter/flutter/issues/63556 【参考方案1】:

花了3个多小时,终于解决了。

对于已经升级到flutter 1.20.1或以上版本的用户,请务必在pubspec.yaml中添加这一行。

dependency_overrides:
  analyzer: '0.39.14'

【讨论】:

【参考方案2】:

我遇到了同样的问题:

请在您的 pubspec 文件中尝试此操作

dependency_overrides:
  analyzer: '0.39.17'    
  build_resolvers: '1.3.10'

【讨论】:

只是 analyzer: ^0.39.17 直接在 dev_dependecies 为我工作【参考方案3】:

试试看:

1-flutter clean

2- 继续开发频道:flutter channel dev

3-升级:flutter upgrade --force

4-flutter pub get

5- 尝试构建

6- 回到稳定或主频道:flutter channel stable (flutter channel master)

7-升级:flutter upgrade --force

【讨论】:

【参考方案4】:

我遇到了同样的问题,如果接受的答案没有解决您的问题,您可以尝试this issue 中描述的程序:

flutter clean flutter pub get flutter packages upgrade

【讨论】:

以上是关于不良状态:意外诊断:颤振升级到 1.20.1 后的主要内容,如果未能解决你的问题,请参考以下文章

颤振——哎呀;颤振意外退出:“FileSystemException:删除失败,路径='...\.ios')

解决VS2015诊断工具意外失败

升级到最新版本后出现颤振错误

错误:当我在颤振验证器之后运行应用程序时,颤振中出现意外的空值

颤振格式异常:意外字符(在字符 1 处)

将颤振从 2.5 升级到 2.8 后出错