为什么Flutter中的Hot Reload会导致“未处理的异常:TimeoutException”?

时间:2019-02-09 16:34:31

标签: flutter android-studio-3.0

我可以在Flutter中运行Hello world Android Studio应用。我尝试测试Hot reload功能时发生了以下问题。

    Unhandled exception:
TimeoutException: Request to Dart VM Service timed out: _reloadSources({pause: true, rootLibUri: file:///data/user/0/com.example.flutterapp/cache/flutter_appBDHNQB/flutter_app/lib/main.dart.incremental.dill, packagesUri: file:///data/user/0/com.example.flutterapp/cache/flutter_appBDHNQB/flutter_app/.packages, isolateId: isolates/1053973743})
#0      VM.invokeRpcRaw (package:flutter_tools/src/vmservice.dart:834:9)
<asynchronous suspension>
#1      Isolate.invokeRpcRaw (package:flutter_tools/src/vmservice.dart:1108:15)
#2      Isolate.reloadSources (package:flutter_tools/src/vmservice.dart:1155:51)
<asynchronous suspension>
#3      FlutterDevice.reloadSources (package:flutter_tools/src/resident_runner.dart:146:66)
#4      HotRunner._reloadSources (package:flutter_tools/src/run_hot.dart:642:73)
<asynchronous suspension>
#5      HotRunner.restart (package:flutter_tools/src/run_hot.dart:580:24)
<asynchronous suspension>
#6      AppInstance.restart (package:flutter_tools/src/commands/daemon.dart:807:19)
#7      AppDomain.restart.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:474:18)
#8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:29)
<asynchronous suspension>
#9      _rootRun (dart:async/zone.dart:1124:13)
#10     _CustomZone.run (dart:async/zone.dart:1021:19)
#11     _runZoned (dart:async/zone.dart:1516:10)
#12     runZoned (dart:async/zone.dart:1463:12)
#13     AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
<asynchronous suspension>
#14     AppInstance._runInZone (package:flutter_tools/src/commands/daemon.dart:820:20)
#15     AppDomain.restart (package:flutter_tools/src/commands/daemon.dart:473:32)
<asynchronous suspension>
#16     Domain.handleCommand.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:193:34)
#17     new Future.sync (dart:async/future.dart:224:31)
#18     Domain.handleCommand (package:flutter_tools/src/commands/daemon.dart:191:9)
#19     Daemon._handleRequest (package:flutter_tools/src/commands/daemon.dart:147:26)
#20     _rootRunUnary (dart:async/zone.dart:1132:38)
#21     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#22     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#23     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#24     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#25     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:132:11)
#26     _MapStream._handleData (dart:async/stream_pipe.dart:232:10)
#27     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:164:13)
#28     _rootRunUnary (dart:async/zone.dart:1132:38)
#29     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#30     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#31     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#32     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#33     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:132:11)
#34     _WhereStream._handleData (dart:async/stream_pipe.dart:207:12)
#35     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:164:13)
#36     _rootRunUnary (dart:async/zone.dart:1132:38)
#37     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#38     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#39     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#40     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#41     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#42     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#43     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
#44     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154:13)
#45     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129:5)
#46     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189:5)
#47     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#48     _rootRunUnary (dart:async/zone.dart:1132:38)
#49     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#50     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#51     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#52     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#53     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#54     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#55     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
#56     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273:7)
#57     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348:20)
#58     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341:5)
#59     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86:18)
#60     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#61     _rootRunUnary (dart:async/zone.dart:1132:38)
#62     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#63     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#64     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#65     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#66     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
#67     _StreamController._add (dart:async/stream_controller.dart:639:7)
#68     _StreamController.add (dart:async/stream_controller.dart:585:5)
#69     _Socket._onData (dart:io/runtime/binsocket_patch.dart:1721:41)
#70     _rootRunUnary (dart:async/zone.dart:1136:13)
#71     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#72     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#73     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#74     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#75     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
#76     _StreamController._add (dart:async/stream_controller.dart:639:7)
#77     _StreamController.add (dart:async/stream_controller.dart:585:5)
#78     new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1283:33)
#79     _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:826:14)
#80     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#81     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#82     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#83     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)

1 个答案:

答案 0 :(得分:0)

如果您使用代理服务器,请设置环境变量

NO_PROXY=127.0.0.1

或也尝试

NO_PROXY=127.0.0.1,localhost