Android Studio中运行和热重装颤振的问题(错误状态:将来已经完成)

时间:2019-01-31 10:55:05

标签: flutter

此问题已提交至Flutter github问题:https://github.com/flutter/flutter/issues/27450

我在Android Studio中运行和热加载flutter应用程序时遇到了一些麻烦。

当我在Android Studio中运行应用程序时,我一次又一次收到以下消息(3次运行中有2次运行),并且构建失败。

Speaker Recognition

我根本无法进行热装工作

Launching lib/main.dart on iPhone XR in debug mode...
Unhandled exception:
Bad state: Future already completed
#0      _AsyncCompleter.complete (dart:async/future_impl.dart:39:31)
#1      _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:490:23)
#2      _NativeSocket.issueWriteEvent.issue (dart:io/runtime/binsocket_patch.dart:844:14)
#3      _NativeSocket.issueWriteEvent (dart:io/runtime/binsocket_patch.dart:851:12)
#4      _NativeSocket.multiplex (dart:io/runtime/binsocket_patch.dart:872:11)
#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

我正在稳定频道上工作。这是我扑扑医生的输出:

Performing hot reload...
Syncing files to device iPhone XR...
Unhandled exception:
Bad state: Future already completed
#0      _AsyncCompleter.complete (dart:async/future_impl.dart:39:31)
#1      _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:490:23)
#2      _NativeSocket.issueWriteEvent.issue (dart:io/runtime/binsocket_patch.dart:844:14)
#3      _NativeSocket.issueWriteEvent (dart:io/runtime/binsocket_patch.dart:851:12)
#4      _NativeSocket.multiplex (dart:io/runtime/binsocket_patch.dart:872:11)
#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

此刻我正在中国工作,我已经实施了此处提到的更改:https://flutter.io/community/china。这是我的.bash_profile文件的相关部分

[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.1 18B75, locale en-AU)
• Flutter version 1.0.0 at /Users/rakshak/flutter
• Framework revision 5391447fae (9 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

⣽Unhandled exception:
Bad state: Future already completed
#0      _AsyncCompleter.complete (dart:async/future_impl.dart:39:31)
#1      _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:490:23)
#2      _NativeSocket.issueWriteEvent.issue (dart:io/runtime/binsocket_patch.dart:844:14)
#3      _NativeSocket.issueWriteEvent (dart:io/runtime/binsocket_patch.dart:851:12)
#4      _NativeSocket.multiplex (dart:io/runtime/binsocket_patch.dart:872:11)
#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

我正在Mac上工作。

4 个答案:

答案 0 :(得分:2)

这看起来像是一个奇怪的建议;但是,您是否在完成此操作时尝试使用vpn?我曾经遇到这个问题,然后使用vpn连接可以帮助我。我想,您可以尝试一下。

答案 1 :(得分:0)

我建议您按照以下步骤重新安装flutter  这个流行的扑扑课程视频。我希望这值得一看  为您服务,您的错误将被删除Flutter Installation Guide  由于您来自中国,因此您必须按照以下步骤添加这些步骤  链接Using Flutter In China

答案 2 :(得分:0)

如果使用代理,请设置环境变量

NO_PROXY=127.0.0.1,localhost

答案 3 :(得分:0)

这似乎是与网络相关的问题。

我对此的解决方法: 我从.bash_profile文件中删除了PUB_HOSTED_URL和FLUTTER_STORAGE_BASE_URL并打开了我的VPN。

您似乎需要一个有效且稳定的Internet连接来构建和热重新加载开发中的flutter应用程序。

相关链接: