Home > Software design >  Flutter windows dektop Lost connection to device
Flutter windows dektop Lost connection to device

Time:08-11

I had installed flutter on windows 10, created a project (default), the project runs in chrome and edge but not as windows desktop application it starts with the windows frame (no content are displayed) after couple of seconds reports

"Lost connection to device."

The Code

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> 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>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

flutter doctor -v 

[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19043.1865], locale en-IN)
• Flutter version 3.0.5 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d5 (4 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\Rajamohan\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12 7-b1504.28-7817840)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.2.32630.192
• Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12 7-b1504.28-7817840)

[√] VS Code (version 1.70.0)
• VS Code at C:\Users\Rajamohan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1865]
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.134
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.47

[√] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!
C:\flutter_apps\test1>flutter --version
Flutter 3.0.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f1875d5 (4 weeks ago) • 2022-07-13 11:24:16 -0700
Engine • revision e85ea0e79c
Tools • Dart 2.17.6 • DevTools 2.12.2

No error or logs are seen, attached the full log generated running the application in verbose mode.

Is there anything I am missing in the installation of flutter in windows 10?, the same setup is running as expected under Linux.

flutter run -d windows -v log

Note: windows 10 running as guest in virtual-box with Linux Mint as Host

CodePudding user response:

Ok, after lot of testing and reading found the limitation of 3D support in Virtualbox, migrated the windows guest to Vmware player and now the flutter desktop application getting build and displayed normally.

The problem still persist in the guest OS installed in Virtualbox.

Since the desktop is running now, I am marking it as solved

  • Related