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
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
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 months ago.
Improve this question
I am getting this error while running the flutter application targeting windows. The project is running on android and the web.
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found.
Exception: Unable to generate build files
And in the console
flutter doctor -v
After running flutter doctor,
C:\Users\ibrahim42386>flutter doctor -v
[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.22616.100], locale en-US)
• Flutter version 3.3.4 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision eb6d86ee27 (6 days ago), 2022-10-04 22:31:45 -0700
• Engine revision c08d7d5efc
• Dart version 2.18.2
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\ibrahim42386\AppData\Local\Android\Sdk
• Platform android-32, build-tools 31.0.0
• ANDROID_HOME = C:\Users\ibrahim42386\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Users\ibrahim42386\AppData\Local\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.3.32922.545
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.3)
• 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.13+0-b1751.21-8125866)
[√] VS Code (version 1.71.2)
• VS Code at C:\Users\ibrahim42386\AppData\Local\Programs\Microsoft
VS Code
• Flutter extension version 3.50.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22616.100]
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77
• Edge (web) • edge • web-javascript • Microsoft Edge 105.0.1343.33
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
What should I do to run this project on windows?
Not sure what's caused it but for some reason my windows application no longer builds.
The error output is the following:
[ +60 ms] C:\Users\George\source\repos\ReactionTracking\src\ReactionTrackerClient\windows\runner\Runner.rc(125): error RC2135: file not found: + [C:\Users\George\source\repos\ReactionTracking\src\ReactionTrackerClient\build\windows\runner\reactions.vcxproj]
[ +1 ms] C:\Users\George\source\repos\ReactionTracking\src\ReactionTrackerClient\windows\runner\Runner.rc(129): error RC2135: file not found: + [C:\Users\George\source\repos\ReactionTracking\src\ReactionTrackerClient\build\windows\runner\reactions.vcxproj]
When I ctrl + click the path directly in VS Code terminal it opens the file fine, so I know the path is valid and the file exists.
Did some research and the closest to my issue I could find was an issue with spaces and special characters in the path, which I have removed as above.
I have deleted the pubspec.lock, tried moving the project into a different folder, running the build command in a terminal running as admin. It was working fine until recently. Wondering if anyone has had any similar issues recently and what they did to fix it?
EDIT
Here is my flutter doctor -v output
[✓] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.22000.675], locale en-AU)
• Flutter version 2.10.5 at C:\Users\George\source\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (7 weeks ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
• Android SDK at E:\AppData\Android
• Platform android-32, build-tools 33.0.0-rc1
• ANDROID_HOME = E:\AppData\Android
• ANDROID_SDK_ROOT = E:\AppData\Android
• Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32421.90
• Windows 10 SDK version 10.0.20348.0
[✓] Android Studio (version 3.6)
• Android Studio at E:\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 1.8.0_212-release-1586-b04)
[✓] VS Code (version 1.67.2)
• VS Code at C:\Users\George\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.42.0
[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.675]
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.53
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Solved by:
Removing windows folder.
Recreate it using flutter create . Repairs and adds the missing files.
If anyone stumbles onto this with the same issue. Still don't know the cause but removing and re-adding windows as a platform sorted it out.
I cloned the repo and Installed Visual Studio and all the necessary tools as stated on the flutter website for windows applications. I have been using flutter for a while now so I have Visual Studio Code installed and configured for flutter. But when I run "flutter run -d windows" I get the error which says:
/D:/src/flutter/.pub-cache/hosted/pub.dartlang.org/visibility_detector-0.2.0/lib/src/visibility_detector_layer.dart(276,21): error G69E91ED9: Too many positional arguments: 1 allowed, but 2 found. [C:\Users\GTL-DAN-002\Documents\Projects\Flutter\flutter-folio\build\windows\flutter\flutter_assemble.vcxproj]
D:\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(242,5): error MSB8066: Custom build for 'C:\Users\GTL-DAN-002\Documents\Projects\Flutter\flutter-folio\build\windows\CMakeFiles\3350ef37c8b8b08ac8c1be72abc20593\flutter_windows.dll.rule;C:\Users\GTL-DAN-002\Documents\Projects\Flutter\flutter-folio\build\windows\CMakeFiles\c9ea6ec0dd188632dc4dfb02305c9fe9\flutter_assemble.rule' exited with code 1. [C:\Users\GTL-DAN-002\Documents\Projects\Flutter\flutter-folio\build\windows\flutter\flutter_assemble.vcxproj]
Below is the output of flutter doctor -v
flutter doctor -v
[√] Flutter (Channel dev, 2.9.0-0.1.pre, on Microsoft Windows [Version 10.0.22000.376], locale en-US)
• Flutter version 2.9.0-0.1.pre at D:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 8f1f9c10f0 (3 weeks ago), 2021-12-14 13:41:48 -0800
• Engine revision 234aca678a
• Dart version 2.16.0 (build 2.16.0-80.1.beta)
• DevTools version 2.9.1
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\GTL-DAN-002\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• 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.0.4)
• Visual Studio at D:\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.0.32014.148
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• 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.10+0-b96-7249189)
[√] VS Code (version 1.63.2)
• VS Code at C:\Users\GTL-DAN-002\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.32.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.376]
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.110
• Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.62
! Device 04669259A7007526 is not authorized.
You might need to check your device for an authorization dialog.
• No issues found!
I'm getting error when trying to debug a newly created project in flutter. This is the LOG before the error.
[ +1 ms] executing: C:\Users\pfernandes\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0123456789ABCDEF shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true --ez start-paused true com.mycompany.my_app_pos_payment_app/com.mycompany.my_app_pos_payment_app.MainActivity
[ +696 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.mycompany.my_app_pos_payment_app/.MainActivity (has extras) }
[ ] Waiting for observatory port to be available...
[ +4 ms] Error waiting for a debug connection: Bad state: No element
[ ] Error launching application on N910.
I can debug without any problem a pure Android project.
This is my flutter doctor:
[√] Flutter (Channel master, v1.14.7-pre.45, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
• Flutter version 1.14.7-pre.45 at c:\sdk\flutter
• Framework revision 9375377fa9 (2 hours ago), 2020-01-30 09:36:41 -0800
• Engine revision f6526c0cf8
• Dart version 2.8.0 (build 2.8.0-dev.6.0 fc3af737c7)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\pfernandes\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code, 64-bit edition (version 1.41.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.7.1
[√] Connected device (1 available)
• N910 • 0123456789ABCDEF • android-arm • Android 5.1.1 (API 22)
• No issues found!
Updating VSCode helped me to fix this problem! Try to update VSCode.
Try again after you migrate your app to AndroidX, it worked for me.
You can follow this doc to learn more about AndroidX migration
The problem needed a firmware update to be solved.
i create flutter project with "Flutter create myapp" and "cd myapp", and the next i'll try run Flutter Run, but my output is:
I have a current stable version of Flutter and the recent sdk Android Q published.
This is my flutter doctor -v:
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [versão 10.0.18363.657], locale pt-BR)
• Flutter version 1.12.13+hotfix.8 at C:\src\flutter
• Framework revision 0b8abb4724 (18 hours ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\lucas\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 43.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.42.0)
• VS Code at C:\Users\lucas\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[√] Connected device (1 available)
• SM J610G • 061f9b46 • android-arm • Android 9 (API 28)
• No issues found!