4
votes

I have newly setup the flutter, but the sample app does not compile. Flutter doctor also show everything is setup properly.

Following is the error:

Launching lib/main.dart on HTC Desire 820G PLUS dual sim in debug mode...
Initializing gradle...                                              1.1s
Resolving dependencies...                                           2.0s
Unhandled exception:                                                    
Crash when compiling package:hello_world/main.dart,                     
at character offset null:                                               
null:4314624: indicated size does not match file size at                
#0      BinaryBuilder.fail (package:kernel/binary/ast_from_binary.dart:98:5)
#1      BinaryBuilder._indexComponents (package:kernel/binary/ast_from_binary.dart:425:15)
#2      BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:453:36)
#3      ProcessedOptions.loadComponent (package:front_end/src/base/processed_options.dart:391:10)
#4      ProcessedOptions.loadSdkSummary (package:front_end/src/base/processed_options.dart:329:32)
<asynchronous suspension>                                               
#5      generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:71:36)
<asynchronous suspension>                                               
#6      withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
<asynchronous suspension>                                               
#7      generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:58:10)
<asynchronous suspension>                                               
#8      kernelForProgram.<anonymous closure> (package:front_end/src/api_prototype/kernel_generator.dart:48:28)
<asynchronous suspension>                                               
#9      CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:134:20)
<asynchronous suspension>                                               
#10     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:46)
#11     new Future.sync (dart:async/future.dart:224:31)                 
#12     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:19)
#13     _rootRun (dart:async/zone.dart:1124:13)                         
#14     _CustomZone.run (dart:async/zone.dart:1021:19)                  
#15     _runZoned (dart:async/zone.dart:1516:10)                        
#16     runZoned (dart:async/zone.dart:1463:12)                         
#17     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:121:12)
#18     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:132:10)
#19     kernelForProgram (package:front_end/src/api_prototype/kernel_generator.dart:47:32)
<asynchronous suspension>                                               
#20     compileToKernel (package:vm/kernel_front_end.dart:309:27)       
<asynchronous suspension>                                               
#21     FrontendCompiler.compile.<anonymous closure> (package:vm/frontend_server.dart:359:56)
#22     new Future.<anonymous closure> (dart:async/future.dart:176:37)  
#23     _rootRun (dart:async/zone.dart:1120:38)                         
#24     _CustomZone.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:1124:13)                         
#28     _CustomZone.run (dart:async/zone.dart:1021:19)                  
#29     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#30     Timer._createTimer.<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:isolate-patch/timer_impl.dart:416:5)
#33     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)


#0      BinaryBuilder.fail (package:kernel/binary/ast_from_binary.dart:98:5)
#1      BinaryBuilder._indexComponents (package:kernel/binary/ast_from_binary.dart:425:15)
#2      BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:453:36)
#3      ProcessedOptions.loadComponent (package:front_end/src/base/processed_options.dart:391:10)
#4      ProcessedOptions.loadSdkSummary (package:front_end/src/base/processed_options.dart:329:32)
<asynchronous suspension>                                               
#5      generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:71:36)
<asynchronous suspension>                                               
#6      withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
<asynchronous suspension>                                               
#7      generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:58:10)
<asynchronous suspension>                                               
#8      kernelForProgram.<anonymous closure> (package:front_end/src/api_prototype/kernel_generator.dart:48:28)
<asynchronous suspension>                                               
#9      CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:134:20)
<asynchronous suspension>                                               
#10     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:46)
#11     new Future.sync (dart:async/future.dart:224:31)                 
#12     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:19)
#13     _rootRun (dart:async/zone.dart:1124:13)                         
#14     _CustomZone.run (dart:async/zone.dart:1021:19)                  
#15     _runZoned (dart:async/zone.dart:1516:10)                        
#16     runZoned (dart:async/zone.dart:1463:12)                         
#17     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:121:12)
#18     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:132:10)
#19     kernelForProgram (package:front_end/src/api_prototype/kernel_generator.dart:47:32)
<asynchronous suspension>                                               
#20     compileToKernel (package:vm/kernel_front_end.dart:309:27)       
<asynchronous suspension>                                               
#21     FrontendCompiler.compile.<anonymous closure> (package:vm/frontend_server.dart:359:56)
#22     new Future.<anonymous closure> (dart:async/future.dart:176:37)  
#23     _rootRun (dart:async/zone.dart:1120:38)                         
#24     _CustomZone.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:1124:13)                         
#28     _CustomZone.run (dart:async/zone.dart:1021:19)                  
#29     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#30     Timer._createTimer.<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:isolate-patch/timer_impl.dart:416:5)
#33     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

Compiler failed on /home/sagar/Documents/aviabird/hello_world/lib/main.dart

FAILURE: Build failed with an exception.                                

* Where:                                                                
Script '/home/sagar/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 665

* What went wrong:                                                      
Execution failed for task ':app:compileflutterBuildDebugArm'.           
> Process 'command '/home/sagar/development/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org                              

BUILD FAILED in 2s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                         3.0s
Gradle task assembleDebug failed with exit code 1

Flutter doctor output:

[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Linux, locale en_IN) • Flutter version 1.7.8+hotfix.4 at /home/sagar/development/flutter • Framework revision 20e59316b8 (2 weeks ago), 2019-07-18 20:04:33 -0700 • Engine revision fee001c93f • Dart version 2.4.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1) • Android SDK at /home/sagar/Android/Sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.1 • Java binary at: /home/sagar/development/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222) • All Android licenses accepted.

[✓] Android Studio (version 3.4) • Android Studio at /home/sagar/development/android-studio • Flutter plugin version 38.1.1 • Dart plugin version 183.6270 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222)

[✓] VS Code (version 1.36.1) • VS Code at /usr/share/code • Flutter extension version 3.3.0

[✓] Connected device (1 available) • 192.168.56.101:5555 • 192.168.56.101:5555 • android-x86 • Android 7.1.1 (API 25)

• No issues found!

2
I see that you are trying to run on physical device HTC Desire 820G PLUS dual sim.. did you try it on emulator to see if it compiles there ?Darshan
Yes the emulator also have the same issueSagarK
I think the issue occurred due to prefetching the development binaries during flutter setup: flutter precacheSagarK
github.com/flutter/flutter/issues/33390 github issue resolved the problem :)SagarK

2 Answers

4
votes

It seems the cache folder for your flutter installation is broken.

You can do steps below in Terminal command line :

rm -rf /Users/XXX/flutter/bin/cache (XXX is Mac user)

flutter doctor -v

flutter run --release

p/s : link

0
votes

Just had a similar issue. In my case there was a type in one of the imports.I had "F" instead of "f" in one if the import files. Just double check all the imports (cases, spaces, underscores, etc) thoroughly .