Flutter Fails on Run (or upgrade, or anything else).

1,265

It's honestly a little hard to tell what's going on from just that error message. Do any errors show up in intellij before you build?

The only things I can think of are:

  • your flutter installation might be corrupted. You could try deleting and re-installing
  • your build directory might have something wrong. Try running flutter clean before building again
  • your libraries aren't being included properly. I'd assume this would show up in intellij, but maybe the paths are set differently there? Check Project Structure -> Libraries and see where the paths are set there.
  • (related to first) you might have multiple instances of flutter on your computer. If intellij is using one while the command line is using another that could potentially cause problems.

If your app happens to be open-source, or you're able to make a new app with the minimum amount of changes to reproduce the error, that would help significantly with diagnosing the problem =).

Share:
1,265
DrainBramage
Author by

DrainBramage

Updated on December 07, 2022

Comments

  • DrainBramage
    DrainBramage over 1 year

    I have been getting a massive error recently, upon Running any of my flutter applications in Intellij, Visual Studio, etc. I cannot perform git functions because of it either. Any help would be greatly appreciated.

    (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)
    
  • DrainBramage
    DrainBramage over 5 years
    Thanks! Suggestion #1 + #4 worked. I (unknowingly) had an older version of Flutter conflicting with the newer one
  • rmtmckenzie
    rmtmckenzie over 5 years
    Glad I could help =)