VSCode 中的 Flutter 未连接到 devtools [英] Flutter in VSCode is not connecting to devtools
问题描述
我正在使用颤振:
Flutter 1.20.0 • 频道稳定 • https://github.com/flutter/flutter.git框架 • 修订版 840c9205b3(6 个月前) • 2020-08-04 20:55:12 -0700引擎 • 修订版 c8e3b94853工具 • Dart 2.9.0
Flutter 1.20.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision 840c9205b3 (6 months ago) • 2020-08-04 20:55:12 -0700 Engine • revision c8e3b94853 Tools • Dart 2.9.0
我仍在使用 Flutter 1.20.0 的主要原因是我自己的问题,我也在这里问过:
the main reason i am still using Flutter 1.20.0 is my own question i asked here also:
是否可以继续使用flutter SDK1.20.0"?不再升级?这种行为会在未来产生什么问题吗?
直到昨天一切都运行良好......今天我试图在 VScode 中打开 devtools,但我一直收到这个:
till yesterday everything was working well...today i am trying to open devtools in VScode but i keep getting this:
我试过:
flutter pub 全局停用 devtools
flutter pub 全局激活 devtools
flutter pub 全局运行 devtools
但没有任何变化
我试过:
flutter pub缓存修复
它重新安装了我所有的项目包....
it reinstalled all my project packages....
我试过了
pub clean
它删除了所有以前的构建
pub clean
it deleted all previous builds
当我尝试使用 flutter run --observatory-port=9200
然后我从 logcat 中获取 URL 并将其粘贴到 devtools 中以连接到当前工作的应用程序..我明白了:
and i take the URL from the logcat and paste it in the devtools to connect to the current working App..i get this:
我可以使用 Flutter Inspector 在 Android Studio 中成功运行 devtools...为什么我不能在 VScode 中使用 devtools!!!
i am able to run devtools in Android studio successfully with Flutter Inspector...why i am not able to use devtools in VScode!!!
推荐答案
这是最近发布的 DevTools 中的一个错误,它没有优雅地处理缺少新 API 的 Flutter 版本:
This was a bug in a recent release of DevTools that didn't gracefully handle versions of Flutter that were missing a new API:
https://github.com/flutter/devtools/issues/2648
此错误已在 DevTools 的 0.9.7+2
版本中修复,VS Code 应自动更新到该版本.如果没有,您可以手动更新:
This bug was fixed in version 0.9.7+2
of DevTools, which VS Code should automatically update to. If it doesn't, you can manually update with:
pub global activate devtools
注意:不要包含 flutter
前缀.
Note: do not include a flutter
prefix.
如果 pub
不在您的 PATH
中,您可能需要使用完整路径运行它,例如:
If pub
isn't in your PATH
you may need to run it with a full path like:
(flutter SDK)\bin\cache\dart-sdk\bin\pub global activate devtools
这篇关于VSCode 中的 Flutter 未连接到 devtools的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!