Flutter build error : Lost connection to device - flutter

I cannot build with the following error message both iOS and Android.
Lost connection to device.
Exited (sigterm)
I try flutter doctor -v
-> % flutter doctor -v
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.2.1 21D62 darwin-arm, locale ja-JP)
• Flutter version 2.10.3 at /Users/hoge/develop/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (5 days ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/hoge/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Users/hoge/Downloads/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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)
[✓] Android Studio (version 2020.3)
• Android Studio at /Users/hoge/Downloads/Android Studio.app/Contents
• 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.65.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.36.0
[✓] Connected device (2 available)
• iPhone 11 (mobile) • F79C5603-6113-4998-AEF8-97D7BEF5C4FB • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.51
! Error: Xcode will continue when iPhone is connected. (code -13)
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
If anyone knows a solution, please let me know.

Finally, the following method solved the problem.
(This may have been a specific problem with my device)
Uninstalling the app on the emulator and then building it solved the problem.

Related

FormatException: SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data on Safari and Firefox

On debug mode everything works fine but when I create a build for the web with flutter build web and deploy I get the JSON.parse: expected property name or '}' error on just Safari and Firefox but on Google Chrome everything works fine.
flutter doctor -v
[✓] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale en-NG)
• Flutter version 3.7.3 on channel stable at /Users/binemmanuel/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9944297138 (8 days ago), 2023-02-08 15:46:04 -0800
• Engine revision 248290d6d5
• Dart version 2.19.2
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/binemmanuel/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_SDK_ROOT = /Users/binemmanuel/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.75.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C65 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!

Visual Studio Code Run Options Are Not Responding For Flutter (Like Run --> Start Debugging)

As the title mention, Visual Studio Code is not responding when I follow,
Run --> Start Debugging
Run --> Run Without Debugging
After trying those ways, the IDE is not giving any reaction. No error log appears on Terminal or Debug Console
The good thing is that "flutter run" is working robustly
What have I tried for a solution?
Checked similar questions on SO
Run "flutter doctor" to check any issue (the log is below)
Checked Dart and Flutter plugins are installed on Visual Studio Code
Restarted Visual Studio Code, also PC
flutter doctor full log
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-x64, locale en-TR)
• Flutter version 3.0.5 at /Users/hede/flutter/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (5 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 31.0.0)
• Android SDK at /Users/hede/Library/Android/sdk
• Platform android-32, build-tools 31.0.0
• ANDROID_HOME = /Users/hede/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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-7281165)
[✓] IntelliJ IDEA Community Edition (version 2022.1.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• 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
[✓] VS Code (version 1.70.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.46.0
[✓] VS Code (version 1.66.2)
• VS Code at /Users/hede/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.46.0
[✓] VS Code (version 1.66.2)
• VS Code at /Users/hede/Downloads/Visual Studio Code 2.app/Contents
• Flutter extension version 3.46.0
[✓] Connected device (2 available)
• Mustafa’s IPhone (mobile) • 00008101-XXXXXXXXXX • ios • iOS 15.5 19F77
• macOS (desktop) • macos • darwin-x64 • macOS 12.4 21F79 darwin-x64
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!

flutter web blank index.html page

My index.html opens a blank page after I release my flutter project for web, and there are some errors in Google Chrome Console:
However, my app works fine in debug mode.
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.4 21F79 darwin-arm, locale en-US)
• Flutter version 2.8.1 at /Users/behnam/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (6 months ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/behnam/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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-7281165)
[✓] VS Code (version 1.67.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.42.0
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
• No issues found!

Flutter Web - space bar key doesn't work in TextFields

whenever I try to press space bar inside a TextField of a Flutter Web Release it doesn't do anything. This occurs on ANY browser except for chrome.
I already tried this "fix":
return MaterialApp(
shortcuts: {
LogicalKeySet(LogicalKeyboardKey.space): ActivateIntent(),
},
And also I upgraded to flutter 2.10, which was a fix to some people. Sadly not for me, so I'm really happy about help.
The issues sometimes goes away if the Site is reloaded several times.
[✓] Flutter (Channel stable, 2.10.2, on macOS 11.1 20C69 darwin-arm, locale
en-DE)
• Flutter version 2.10.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 097d3313d8 (5 days ago), 2022-02-18 19:33:08 -0600
• Engine revision a83ed0e5e3
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 12.5.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
! Flutter recommends a minimum Xcode version of 13.
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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-7281165)
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.102
[✓] HTTP Host Availability
• All required HTTP hosts are available

flutter failed to connect android device and off application on iPhone simulator

when I call debug mode on an android device
Error connecting to the service protocol: failed to connect to http://127.0.0.1:60027/bncnE_T-mWw=/
and also asks for permission to wifi, but through a notification, if I give permission, it shows a white screen and the same error
but everything starts quietly if you build the apk and install through it
with an iPhone simulator, the application starts and immediately closes, and in the android studio it is written that the connection is taking too long, it may have crashed
flutter doctor:
[✓] Flutter (Channel stable, 2.5.0, on Mac OS X 10.15.7 19H114 darwin-x64, locale ru-RU)
• Flutter version 2.5.0 at /Users/daniil/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (6 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/daniil/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.8+10-b944.6916264)
[✓] VS Code (version 1.58.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (3 available)
• Redmi Note 8T (mobile) • 19645373 • android-arm64 • Android 10 (API 29)
• iPhone 8 Plus (mobile) • 06EE905E-8A76-45D5-A844-8DCDF2EEA3CA • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.63
• No issues found!
Android the problem was solved by delete update "security" on firmware MIUI