Observatory server failed to start - Fails to create Socket Server

蹲街弑〆低调 提交于 2020-07-06 11:30:23

问题


I'm building some internal tooling for myself to generate Flutter apps using some templates that I've setup along with some additional functionality that I can share between apps.

At the moment the code compiles, builds fine and deploys but it gets stuck on the first view (blank white screen) and retries to start the Observatory server 11 times before failing. There are no other errors besides the one below.

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
I/flutter ( 7011): Observatory server failed to start after 1 tries
I/flutter ( 7011): Observatory server failed to start after 2 tries
I/flutter ( 7011): Observatory server failed to start after 3 tries
I/flutter ( 7011): Observatory server failed to start after 4 tries
I/flutter ( 7011): Observatory server failed to start after 5 tries
I/flutter ( 7011): Observatory server failed to start after 6 tries
I/flutter ( 7011): Observatory server failed to start after 7 tries
I/flutter ( 7011): Observatory server failed to start after 8 tries
I/flutter ( 7011): Observatory server failed to start after 9 tries
I/flutter ( 7011): Observatory server failed to start after 10 tries
I/flutter ( 7011): Observatory server failed to start after 11 tries
I/flutter ( 7011): Could not start Observatory HTTP server:
I/flutter ( 7011): SocketException: Failed to create server socket (OS Error: Permission denied, errno = 13), address = 127.0.0.1, port = 0
I/flutter ( 7011): #0      _NativeSocket.bind (dart:io/runtime/bin/socket_patch.dart:591:7)
I/flutter ( 7011): <asynchronous suspension>
I/flutter ( 7011): #1      _RawServerSocket.bind (dart:io/runtime/bin/socket_patch.dart:1206:26)
I/flutter ( 7011): #2      _ServerSocket.bind (dart:io/runtime/bin/socket_patch.dart:1466:29)
I/flutter ( 7011): #3      ServerSocket.bind (dart:io/runtime/bin/socket_patch.dart:1457:26)
I/flutter ( 7011): #4      _HttpServer.bind (dart:_http/http_impl.dart:2520:25)
I/flutter ( 7011): #5      HttpServer.bind (dart:_http/http.dart:227:19)
I/flutter ( 7011): #6      Server.startup.poll (dart:vmservice_io/server.dart:355:36)
I/flutter ( 7011): <asynchronous suspension>
I/flutter ( 7011): #7      Server.startup (dart:vmservice_io/server.dart:367:23)
I/flutter ( 7011): <asynchronous suspension>
I/flutter ( 7011): #8      main (dart:vmservice_io/vmservice_io.dart:253:12)
I/flutter ( 7011): 

My question's are:

  • how do I go about debugging this problem?
  • Do you have an idea of what can cause this?

The code looks the same as the template I'm working off (that works) with the only difference being the package name is different.

Edit 1

Here is the link to the project that hangs for reproduction.


回答1:


When I was stripping down the template I unknowingly removed the debug folder under android/app/src thinking it was files generated from the build. That's the manifest Android uses to allow debugging so it needs to be there.




回答2:


In Android Manifest file add Internet Permission. I'm also facing this problem. after adding this permission now working fine.

<uses-permission android:name="android.permission.INTERNET"/>

Problem is Internet permission is needed in debug mode.

Android Manifest file have description for this

The INTERNET permission is required for development. Specifically, flutter needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc.



来源:https://stackoverflow.com/questions/55119887/observatory-server-failed-to-start-fails-to-create-socket-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!