Home > Back-end >  Running Gradle task 'assembleDebug'... Unhandled exception: Crash when compiling null, at
Running Gradle task 'assembleDebug'... Unhandled exception: Crash when compiling null, at

Time:01-15

When creating a project, it immediately gives the following error flutter doctor - OK!

enter image description here

    Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Unhandled exception:
Crash when compiling null,
at character offset null:
Unsupported operation: _ExplicitNamedTypeBuilder.registerInferredType
#0      TypeBuilder.registerInferredType (package:front_end/src/fasta/builder/type_builder.dart:350:5)
#1      DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals.performRecoveryForErroneousCase (package:front_end/src/fasta/source/source_constructor_builder.dart:355:23)
#2      DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals (package:front_end/src/fasta/source/source_constructor_builder.dart:375:14)
#3      DeclaredSourceConstructorBuilder.inferFormalTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:290:9)
#4      DeclaredSourceConstructorBuilder.inferTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:263:5)
#5      InferableTypeBuilder.inferType (package:front_end/src/fasta/builder/omitted_type_builder.dart:149:19)
#6      SourceLoader.performTopLevelInference (package:front_end/src/fasta/source/source_loader.dart:2358:19)
#7      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:532:14)
<asynchronous suspension>
#8      withCrashReporting (package:front_end/src/fasta/crash.dart:122:12)
<asynchronous suspension>
#9      IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:407:33)
<asynchronous suspension>
#10     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:68:50)
<asynchronous suspension>
#11     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:11)
<asynchronous suspension>
#12     listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1210:11)
<asynchronous suspension>


#0      TypeBuilder.registerInferredType (package:front_end/src/fasta/builder/type_builder.dart:350:5)
#1      DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals.performRecoveryForErroneousCase (package:front_end/src/fasta/source/source_constructor_builder.dart:355:23)
#2      DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals (package:front_end/src/fasta/source/source_constructor_builder.dart:375:14)
#3      DeclaredSourceConstructorBuilder.inferFormalTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:290:9)
#4      DeclaredSourceConstructorBuilder.inferTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:263:5)
#5      InferableTypeBuilder.inferType (package:front_end/src/fasta/builder/omitted_type_builder.dart:149:19)
#6      SourceLoader.performTopLevelInference (package:front_end/src/fasta/source/source_loader.dart:2358:19)
#7      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:532:14)
<asynchronous suspension>
#8      withCrashReporting (package:front_end/src/fasta/crash.dart:122:12)
<asynchronous suspension>
#9      IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:407:33)
<asynchronous suspension>
#10     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:68:50)
<asynchronous suspension>
#11     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:11)
<asynchronous suspension>
#12     listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1210:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.

enter image description here

android studio reinstall didn't help.

in my case the solutions from this page do not work StatelessWidget : Classes can only extend other classes.dart(extends_non_class) - issue

CodePudding user response:

In my case, I got a similar error when:

  • the physical memory on my laptop was full, and I just needed to free it up a little
  • I just updated the Flutter version to the latest

CodePudding user response:

You can also try running flutter clean in the terminal, and then flutter pub get. This works often in these kinds of situations.

  • Related