currently I'm having a problem with running flutter applications. I tried to search solutions, but none of them was actually my case. The problem is, when I try to install an application, sometimes it starts running, but instantly crashes, or not even build, and throws this exception (even with flutter demo project):
Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:57564/ws".
What I've tried so far: Cleaning cashes, reinstall flutter/android studio. I got this problem only with a few (android os) mobile. import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(appBar: AppBar(title: Text("App"))),
);
}
}
I solved this problem creating a new emulator device but NOT using the most recent Android Image.
Android Studio > Configure > AVD Manager > Create Virtual Device > (Choose a device model) > (Select a system image, but NOT the most recent)
In my case, I had the following Android images as choices: Q, Pie 28, Oreo 27 and 26, etc. I selected Pie 28 and the problem was solved. The problem was occuring with Android Q (most recent).
The problem is with the API version. Choose 28 It fixes the problem.
I use a real device and my problem was only solved when I deleted a plugin from pubspec.yaml
file. Maybe this can help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With