0
votes

I start to learn flutter and set up all settings and other things. But when I start project in VS Code or Android Studio I take this error "Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:60944/JpB2Y6E0g_g=/ws" and app don't start but when I go terminal and say "flutter run" then I have still take this error but application starts. Hovever I cant run application direckly and can't use "HOT-RELOAD"

I try clear flurred and close defender or any antivirus program that I have and somethings in the internet but any of them couldn't help me

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: MyHomePage(title: 'Flutter Anasayfa'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {

      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

I cant run project direckly only run from terminal ı want run application on the IDE and use "hot-reload"

1

1 Answers

0
votes

Try to downgrade your Android version form Q to Pie. It worked for me and many others on here