Flutter运行失败(或升级,或其他任何原因)。

时间:2018-09-20 18:12:31

标签: crash dart flutter ios-simulator startup

最近,在Intellij,Visual Studio等中运行我的任何flutter应用程序时,我都遇到了一个大错误。因此,我也无法执行git函数。任何帮助将不胜感激。

(Some parts omitted - this snippet represents the 40k line code pattern)

Launching lib/main.dart on iPhone X in debug mode...
compiler message: 

 file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/widgets/editable_text.dart:439:9: Error: Type 'LayerLink' not found.
compiler message:   final LayerLink _layerLink = new LayerLink();
compiler message:         ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:4474:20: Error: The method 'getLastTransform' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'getLastTransform'.
compiler message:     return _layer?.getLastTransform() ?? new Matrix4.identity();
compiler message:                    ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:4501:18: Error: Method not found: 'FollowerLayer'.
compiler message:     _layer = new FollowerLayer(
compiler message:                  ^^^^^^^^^^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/texture.dart:76:7: Error: No named parameter with the name 'rect'.
compiler message:       rect: new Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
compiler message:       ^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:124:11: Error: 'ContainerLayer' isn't a type.
compiler message:     final ContainerLayer rootLayer = TransformLayer(transform: _rootTransform);
compiler message:           ^^^^^^^^^^^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:124:38: Error: Method not found: 'TransformLayer'.
compiler message:     final ContainerLayer rootLayer = TransformLayer(transform: _rootTransform);
compiler message:                                      ^^^^^^^^^^^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:124:38: Error: The method 'TransformLayer' isn't defined for the class '#lib1::RenderView'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'TransformLayer'.
compiler message:     final ContainerLayer rootLayer = TransformLayer(transform: _rootTransform);
compiler message:                                      ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:125:15: Error: The method 'attach' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'attach'.
compiler message:     rootLayer.attach(this);
compiler message:               ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:195:13: Error: The method 'addToScene' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'addToScene'.
compiler message:       layer.addToScene(builder, Offset.zero);
compiler message:             ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:215:58: Error: The method 'find' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'find'.
compiler message:     final SystemUiOverlayStyle upperOverlayStyle = layer.find<SystemUiOverlayStyle>(top);
compiler message:                                                          ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:220:35: Error: The method 'find' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'find'.
compiler message:         lowerOverlayStyle = layer.find<SystemUiOverlayStyle>(bottom);
compiler message:                                   ^
Compiler failed on /Users/JohnnySmithh/IdeaProjects/MyCoolProject/lib/main.dart
Error launching application on iPhone X.
Exited (sigterm)

1 个答案:

答案 0 :(得分:0)

老实说,仅凭该错误消息很难判断出发生了什么。构建之前,intellij中是否会显示任何错误?

我唯一能想到的是:

  • 您的flutter安装可能已损坏。您可以尝试删除并重新安装
  • 您的构建目录可能有问题。尝试运行flutter clean,然后再重新构建
  • 您的库未正确包含。我以为这会出现在intellij中,但也许在那儿设置的路径不同?检查项目结构->库,并查看在哪里设置路径。
  • (与第一个有关)您的计算机上可能有多个抖动实例。如果intellij在命令行中使用另一个时可能会导致问题。

如果您的应用恰好是开源的,或者您能够用最少的更改制作新的应用来重现错误,那么这将大大有助于诊断问题=)。