title: Trouble with running and hot reloading flutter in Android studio(Bad state: Future already completed)
body: <p><strong>This issue has been submitted to the Flutter github issues: <a href="https://github.com/flutter/flutter/issues/27450" rel="nofollow noreferrer">https://github.com/flutter/flutter/issues/27450</a></strong> </p>
  
  <p>I am having some trouble with running and hot reloading flutter apps in Android studio. </p>
  
  <p>When I run an app in Android studio, I get the following message every now and again(2 out of 3 runs) and the build fails. </p>
  
  <pre><code>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.&lt;anonymous closure&gt;.connectNext.&lt;anonymous closure&gt; (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)
  </code></pre>
  
  <p>I have not been able to get hot reload to work at all</p>
  
  <pre><code>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.&lt;anonymous closure&gt;.connectNext.&lt;anonymous closure&gt; (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)
  </code></pre>
  
  <p>I am working on the stable channel. Here is my output of flutter doctor: </p>
  
  <pre><code>[✓] 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.&lt;anonymous closure&gt;.connectNext.&lt;anonymous closure&gt; (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)
  </code></pre>
  
  <p>I am working from China at the moment, I have implemented the changes mentioned here: <a href="https://flutter.io/community/china" rel="nofollow noreferrer">https://flutter.io/community/china</a>. Here are the relevant parts of my .bash_profile file</p>
  
  <pre><code>export PUB_HOSTED_URL=https://pub.flutter-io.cn
  export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  export PATH=$PATH:/Users/rakshak/flutter/bin
  </code></pre>
  
  <p>I am working on a Mac. </p>