Error connecting to the service protocol: Exception: Attempted to connect to Dart observatory 5 times, and all attempts failed. Giving up. The URL was

Viewed 2789

My app starts but then stops because of the error. I am using Windows 10, android studio as an IDE, and trying to build an android app.

if I use a terminal outside of Android studio it works, so it should be android studio related.

console:

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
Error connecting to the service protocol: Exception: Attempted to connect to 
Dart observatory 5 times, and all attempts failed. Giving up. The URL was 
ws://127.0.0.1:50997/ws

flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 
10.0.16299.847], locale de-DE)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
X Android license status unknown.
[√] Android Studio (version 3.2)
[√] Connected device (1 available)

! Doctor found issues in 1 category.
1 Answers

If you have configured a proxy, ensure you have also set the environment variable

NO_PROXY=127.0.0.1
Related