material-components / material-components-flutter-codelabs

Codelabs for Material Components for Flutter
212 stars 247 forks source link

Compile error when trying to run 101-starter #162

Closed likhit-vivek closed 5 years ago

likhit-vivek commented 5 years ago

I just setup the project and opened 'mdc_100_series' directory in my workspace. Ran flutter doctor -v and everything is fine. When I try to run the app using flutter run, I'm getting the following error:

Compiler message:
file:///C:/Users/lvchi/Documents/flutter/packages/flutter/lib/src/widgets/text_selection.dart:1: Error: The control character
U+0000 can only be used in strings and comments.
file:///C:/Users/lvchi/Documents/flutter/packages/flutter/lib/src/cupertino/route.dart:1: Error: The control character U+0000
can only be used in strings and comments.
file:///C:/Users/lvchi/Documents/flutter/packages/flutter/lib/src/rendering/editable.dart:1: Error: The control character U+0000 can only be used in strings and comments.
U
nhandled exception:
Crash when compiling package:flutter/src/painti
ng/text_painter.dart,
at character offset null:
NoSuchMethodError: The getter 'next' was called on null.
Receiver: null
Tried cal
ling: next
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1      defaultRecoveryS
trategy (package:front_end/src/fasta/scanner/recover.dart:158:66)
#2      _tokenizeAndRecover (package:front_end/s
rc/fasta/scanner.dart:94:21)
#3      scan (package:front_end/src/fasta/scanner.dart:67:10)
#4      SourceLoader.tokenize (package:fr
ont_end/src/fasta/source/source_loader.dart:202:28)
<asynchronous suspension>
#5      SourceLoader.buildOutline (package
:front_end/src/fasta/source/source_loader.dart:263:26)
<asynchronous suspension>
#6      Loader.buildOutlines (package:front_end/src/fasta/loader.dart:198:13)
<asyn
chronous suspension>
#7      KernelTarget.buildOutlines.<anonymous closure> (package:front_e
nd/src/fasta/kernel/kernel_target.dart:251:20)
<asynchronous suspension>
#8      withCrashReporting (package:front_end/src/fasta/crash
.dart:122:24)
<asynchronous suspension>
#9      KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:249:
12)
<asynchronous suspension>
#10     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/
fasta/incremental_compiler.dart:299:52)
<asynchronous suspension>
#11     CompilerContext.runInContext.<anonymous closure>.<a
nonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:46)
#12     new Futur
e.sync (dart:async/future.dart:224:31)
#13     CompilerContext.runInContext.<anony
mous closure> (package:front_end/src/fasta/compiler_cont
ext.dart:122:19)
#14     _rootRun (dart:async/zone.dart:1124:13)
#15     _CustomZone.run (dart:async/zone.dart:1021:19)
#16     _runZoned (dart:async/zone.dart:1516:10)

#17     runZoned (dart:async/zone.dart:1463:12)
#18   
  CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.
dart:121:12)
#19     IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:127:20)
<asynchronous suspe
nsion>
#20     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:48:44)
<asynchronous suspension>
#21     FrontendCompiler.compi
l
e.<anonymous closure> (package:
vm/frontend_server.dart:341:67)
#22     new Future.<anonymous clo
s
ure> (dart:async/future.dart:176:37)
#23     _rootRun (dart:async/zone.dart:1120:38)
#24     _Custo
mZone.run (dart:async/zone.dart:1021:19)

#
25     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#26     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#
27     _rootRun (dart:async/zone.dart:112
4:13)
#28     _CustomZone.run (dart:async/zone.dart:1021:19
)
#29     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#30     Timer._createTime
r.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
#31     _Timer._
runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#32     _Timer._handleMessage (dart:isolat
e-patch/timer_impl.dart:416:5)
#33     _RawReceivePortImpl._handleMessage (dart
:isolate-patch/isolate_patch.da
rt:171:12)

#0    

 Object.noSuchMeth
od (dart:core-patch/object_patch.dart:50:5)
#1      defaultRecoveryStrategy (
package:front_end/src/fasta/scanner/recover.dart:158:66)
#2      _tokenizeAndRecover (
package:front_end/src/fasta/scanner.dart:94:21)
#3      scan (package:fro
nt_end/src/fasta/scanner.dart:67:10)
#4      SourceLoader.tokenize (package:front_end/src/fasta/source/source_loader.da
rt:202:28)
<asynchronous suspension>
#5      SourceLoader.buildOutline (
package:front_end/src/fasta/source/source_loader.dart:263:26)
<asynchronous suspensio
n>
#6      Loader.buildOutlines (package:front_end/src/fasta/loader.dart:198:13)
<asynchro
nous suspension>
#7      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:25
1:20)
<asynchronous suspension>
#8      withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
<asynchronous suspension>
#9
      KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:249:12)
<asynchronous suspension>
#10     In
crementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:299:52)
<asynchronous susp
ension>
#11     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart
:122:46)
#12     new Future.sync (dart:async/future.dart:224:31)
#13     CompilerContext.runInContext.<anonymous cl
osure> (package:front_end/src/fasta/compiler_context.dart:122:19)
#14     _rootRun (dart:async/zone.dart:1124:13)
#15     _C
ustomZone.run (dart:async/zone.dart:1021:19)
#16     _runZoned (dart:async/zone.dart:1516:10)
#17   
  runZoned (dart:async/zone.dart:1463:12)
#18     CompilerContext.runInContext (package:front
_end/src/fasta/compiler_context.dart:121:12)
#19     IncrementalCompiler.computeDelta (p
ackage:front_end/src/fasta/incremental_compiler.dart:127:20)
<asynchronous suspension>
#20     
IncrementalCompiler.compile (package:vm/incremental_compiler.dart:48:44)
<asynchronous suspension>
#21     Fron
tendCompiler.compile.<anonymous closure> (package:vm/frontend_server.dart:341:67)
#22     new Future.<anonymous clo
sure> (dart:async/future.dart:176:37)
#23     _rootRun (dart:async/zone.dart:1120
:38)
#24     _CustomZone.run (dart:async/zone.dar
t:1021:19)
#25     _CustomZone.runGuarded (dart:asy
nc/zone.dart:923:7)
#26 
    _CustomZone.bindCallbackGuarded.<anonymou
s closure> (dart:async/zone.dart:963:23)
#27     _rootRun (dart:async/zone.da
r
t:1124:13)

#28     _CustomZone.run (d
a
rt:async/zone.da
rt:1021:19)
#29     _CustomZone.bindCallback.<anonymous closure> (da
rt:async/zone.dart:947:23)
#30     Timer._createTimer.<anonymous closure> (da
rt:async-patch/timer_patch.dart:21:15)
#31     _Timer._runTimers (dart:isolate-patch
/timer_impl.dart:382:19)
#32     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#33   
  _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)

Compiler failed on C:\Users\lvchi\Documents\material-components-flutter-codelabs\mdc_100_series\lib/main.dart
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        31.9s
Gradle task assembleDebug failed with exit code 1

I haven't made any changes to the app, so I don't understand why it's not working!

likhit-vivek commented 5 years ago

I'm getting the same error when I run a different flutter project, which I was able to run previously.

I'm using VS code and I'm getting Dart Analyzer crashed notification. So, I uninstalled both Dart and Flutter extensions and tried again but still getting the same error. Any suggestions? Thanks.

likhit-vivek commented 5 years ago

Running flutter upgrade is causing the issue. Flutter got updated from 1.2.1 to 1.5.* and somehow it's causing a problem with Dart.... Reverted back to 1.2.1 and the issue is gone.