【错误记录】flutter attach 附加设备 执行报错 ( 附加设备注意事项 )

文章目录

一、错误记录


1、只能有一个终端执行 Flutter 项目

执行

shell 复制代码
flutter run -d PXUYD22628020934

命令 , 如果在一个 命令行 正在运行 Flutter 项目 , 此时在 另外一个命令行终端 运行 上述命令 , 就会报错 :

shell 复制代码
D:\002_Project\001_Flutter\client_terminal\build\app\outputs\flutter-apk>flutter attach -d PXUYD22628020934
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Target file "lib\main.dart" not found.

2、正在运行的项目无法附加

Flutter 项目正在运行 , 执行

groovy 复制代码
flutter attach -d PXUYD22628020934

命令 , 就会报如下错误 , 会一直卡在 Waiting for a connection from Flutter on CTR AL00... 位置 ;

shell 复制代码
D:\002_Project\001_Flutter\client_terminal>flutter attach -d PXUYD22628020934
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Waiting for a connection from Flutter on CTR AL00...
The Dart VM Service was not discovered after 30 seconds. This is taking much longer than expected...

二、解决方案


建议按照如下 的 执行顺序 执行命令 ;

首先 , 执行 下面的命令 , 运行一次 Flutter 项目 ;

shell 复制代码
flutter run -d PXUYD22628020934

然后 , 按 q -> 回车 , 退出应用 ;

再后 , 执行下面的命令 ,附加设备 :

shell 复制代码
flutter attach -d PXUYD22628020934

执行完命令后 , 会卡在 Waiting for a connection from Flutter on CTR AL00... 位置 ;

shell 复制代码
D:\002_Project\001_Flutter\client_terminal>flutter attach -d PXUYD22628020934
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Waiting for a connection from Flutter on CTR AL00...

最后 , 手机应用中 , 重启 Flutter 项目 , 一定要 杀进程 彻底退出应用 ;

shell 复制代码
D:\002_Project\001_Flutter\client_terminal>flutter attach -d PXUYD22628020934
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Waiting for a connection from Flutter on CTR AL00...
Syncing files to device CTR AL00...                              2,215ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on CTR AL00 is available at: http://127.0.0.1:2802/qSS8xKqjAL8=/
The Flutter DevTools debugger and profiler on CTR AL00 is available at:
http://127.0.0.1:2802/qSS8xKqjAL8=/devtools/?uri=ws://127.0.0.1:2802/qSS8xKqjAL8=/ws
相关推荐
小磊哥er1 小时前
深入解构Claude Code - 第 7 篇 · 连接外面的世界
javascript·ai编程
小磊哥er2 小时前
深入解构Claude Code - 第 6 篇 · 终端里的图形界面
javascript·ai编程
海兰2 小时前
【应用】基于 Next.js 16 + Python mplfinance的金融K线图与技术指标可视化平台(一)
javascript·python·金融
_祝你今天愉快2 小时前
从驱动来分析服务的添加过程
android
可乐鸡翅yeah_3 小时前
hls.js 内存泄漏实战排查,直播 M3U8 长时间播放异常定位方案
开发语言·javascript·python·django·ecmascript·m3u8·m3u8在线
可乐鸡翅yeah_3 小时前
第三方接口对接 M3U8 流媒体排坑实战,解决外部服务商流兼容难题
前端·javascript·python·django·html·m3u8·m3u8在线
默_笙4 小时前
🏠 「LLM Notes」:我用 Next.js + Redis 给自己造了个笔记博客
前端·javascript
Dovis(誓平步青云)5 小时前
折叠屏悬停看视频,上半屏和下半屏应该各做什么
android·java·服务器·开发语言·安全·音视频
ruanCat5 小时前
Prettier 明明执行成功,Markdown 为什么还是没变?一次插件误诊复盘
前端·javascript·node.js
软件开发技术深度爱好者6 小时前
在线学习实践 TypeScript 的官方Playground(演练场)使用介绍
javascript·学习·typescript