Files
App.K12.Student.Miniapp_Flu…/debug-flutter-compile-crash.md
T
2026-09-04 15:22:20 +08:00

28 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[OPEN]
# flutter-compile-crash
## 症状
- `flutter run` 编译阶段崩溃:`Crash when compiling: Null check operator used on a null value`
- 堆栈来自 Flutter kernel transformation:`track_widget_constructor_locations.dart`
- `flutter run --no-track-widget-creation` 也无法启动
## 预期
- App 可正常编译启动
## 假设 (待证伪)
- H1: Flutter SDK/Dart 版本与新增依赖(connectivity_plus / flutter_local_notifications / timezone / flutter_timezone)存在最低版本不兼容,导致前端工具链在 kernel transform 阶段崩溃
- H2: Pub 缓存或依赖解析异常(镜像/缓存损坏/半下载)导致编译输入不完整,从而触发 kernel transform NPE
- H3: 代码中存在导致 kernel transform 崩溃的语法/构造(与 Widget 创建追踪相关),例如工具链在处理某处 AST 时拿不到 source location
- H4: Flutter 工具链 bug(特定版本已知问题),需要通过升级/降级 Flutter 或禁用某些 transform 来规避
## 需要收集的证据
- Flutter/Dart 版本:`flutter --version`
- 工具链信息:`flutter doctor -v`
- 依赖解析:`flutter pub get -v` 的关键错误(如版本约束/缓存/镜像)
- 编译日志:`flutter run -v` 的完整崩溃段落(含“是哪一个文件/库正在编译”)
## 进展记录
- 2026-09-02:创建调试记录,等待用户提供版本与 verbose 日志