Flutter 将调试器输出附加到哪里?
Where does Flutter's attach debugger output to?
- 对于这个实验,我使用了一个未经修改的默认 Flutter 项目,我正在通过 usb 在 note 9 上进行测试。
- VS 代码版本:1.34.0.
- Dart 扩展版本:3.1.0.
- Flutter 扩展版本:3.1.0.
- Flutter 医生输出:
[√] Android toolchain - develop for Android devices
(Android SDK version 28.0.3)
• Android SDK at C:\Users\Landon
Blackledge\AppData\Local\Android\sdk
• Android NDK location not configured (optional;
useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android
Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[!] Android Studio (version 3.4)
• Android Studio at C:\Program
Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter
specific functionality.
X Dart plugin not installed; this adds Dart
specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
[√] VS Code, 64-bit edition (version 1.34.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.1.0
[√] Connected device (1 available)
• SM N960U • 29d9117531047ece • android-arm64 •
Android 9 (API 28)
每当我在终端中输入 "flutter run" 时,一切都运行顺利,即热重载和重新启动工作以及记录和打印输出到终端!
同样如此,每当我在"Debug"面板上点击"Start Debugging";唯一的区别是我必须使用 CTRL+F5 和 CTRL+SHIFT+F5(而不是在终端中输入 "r" 和 "R")进行热重载和重新启动,并将输出记录和打印到 "DEBUG CONSOLE".
我的问题是由于更改默认的 launch.json 文件造成的...
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart"
}
]
}
对此...
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "attach",
"type": "dart"
}
]
}
现在,无论何时单击 "Start Debugging",我的打印件和日志都不会显示在任何地方!他们可以输出到哪里?
Flutter attach 显示 DevTools 调试器和分析器的输出,您必须打开它并为 运行 应用程序提供 URL。
- 对于这个实验,我使用了一个未经修改的默认 Flutter 项目,我正在通过 usb 在 note 9 上进行测试。
- VS 代码版本:1.34.0.
- Dart 扩展版本:3.1.0.
- Flutter 扩展版本:3.1.0.
- Flutter 医生输出:
[√] Android toolchain - develop for Android devices
(Android SDK version 28.0.3)
• Android SDK at C:\Users\Landon
Blackledge\AppData\Local\Android\sdk
• Android NDK location not configured (optional;
useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android
Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[!] Android Studio (version 3.4)
• Android Studio at C:\Program
Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter
specific functionality.
X Dart plugin not installed; this adds Dart
specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
[√] VS Code, 64-bit edition (version 1.34.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.1.0
[√] Connected device (1 available)
• SM N960U • 29d9117531047ece • android-arm64 •
Android 9 (API 28)
每当我在终端中输入 "flutter run" 时,一切都运行顺利,即热重载和重新启动工作以及记录和打印输出到终端!
同样如此,每当我在"Debug"面板上点击"Start Debugging";唯一的区别是我必须使用 CTRL+F5 和 CTRL+SHIFT+F5(而不是在终端中输入 "r" 和 "R")进行热重载和重新启动,并将输出记录和打印到 "DEBUG CONSOLE".
我的问题是由于更改默认的 launch.json 文件造成的...
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart"
}
]
}
对此...
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "attach",
"type": "dart"
}
]
}
现在,无论何时单击 "Start Debugging",我的打印件和日志都不会显示在任何地方!他们可以输出到哪里?
Flutter attach 显示 DevTools 调试器和分析器的输出,您必须打开它并为 运行 应用程序提供 URL。