Flutter + Codebuddy的坑

我用codebuddy做一个项目java+flutter,codebuddy根据我描述很快做好了前后端。

遇到几个问题:

1、运行不成功,flutter run -d windows,

Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/. Make sure you trust this source!

Launching lib\main.dart on Windows in debug mode...

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(249,5): error MSB8066: ��D:\AI_DEV\MoGuFileSync\MoGuApp\build\windows\x64\CMakeFiles\7d255c9d2ce567daaf5d1801c4ad993f\flutter_windows.dll.rule;D:\AI_DEV\MoGuFileSync\MoGuApp\build\windows\x64\CMakeFiles\58152acb4b2ecf2a979f0e3e45a33119\flutter_assemble.rule�����Զ����������˳�������Ϊ 255�� D:\\AI_DEV\\MoGuFileSync\\MoGuApp\\build\\windows\\x64\\flutter\\flutter_assemble.vcxproj

Building Windows application... 2,146ms

Error: Build process failed.

我之前也在同级目录做了个Flutter web项目都能运行。

ai折腾很久没有解决,网络上说可能是中文路径。我也改过cmd的默认编码。

都不行。

cd build\windows\x64

msbuild ALL_BUILD.vcxproj /v:d

报错:

Generating D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter/ephemeral/flutter_windows.dll, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter/ephemeral/flutter_export.h, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flut

ter/ephemeral/flutter_windows.h, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter/ephemeral/flutter_messenger.h, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter/ephemeral/flutter_plugin_registrar.h, D:/AI_DEV/M

oGuFileSync/MoGuApp/windows/flutter/ephemeral/flutter_texture_registrar.h, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter/ephemeral/cpp_client_wrapper/core_implementations.cc, D:/AI_DEV/MoGuFileSync/MoGuApp/

windows/flutter/ephemeral/cpp_client_wrapper/standard_codec.cc, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter/ephemeral/cpp_client_wrapper/plugin_registrar.cc, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter

/ephemeral/cpp_client_wrapper/flutter_engine.cc, D:/AI_DEV/MoGuFileSync/MoGuApp/windows/flutter/ephemeral/cpp_client_wrapper/flutter_view_controller.cc, phony

活动代码页: 936

Unhandled exception:

FormatException: Unexpected extension byte (at offset 0)

#0 _Utf8Decoder.convertChunked (dart:convert-patch/convert_patch.dart:1959:7)

#1 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:310:28)

#2 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:306:5)

......

#18 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:2326:31)

#19 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1649:14)

#20 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)

#21 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

#22 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:127:13)

#23 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:194:5)

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(249,5): error MSB8066: "D:\AI_DEV\MoGuFileSync\MoGuApp\build\windows\x64\CMakeFiles\7d255c9d2ce567d

aaf5d1801c4ad993f\flutter_windows.dll.rule;D:\AI_DEV\MoGuFileSync\MoGuApp\build\windows\x64\CMakeFiles\58152acb4b2ecf2a979f0e3e45a33119\flutter_assemble.rule"的自定义生成已退出,代码为 255。 [D:\AI_DEV\MoGuFileSync\MoGuApp\

build\windows\x64\flutter\flutter_assemble.vcxproj]

报错给ai,ai说我的cmd编码有问题,于是我改回了chcp 65001。

......

就是flutter windows不要有中文。cmd编码要utf-8

2、√ Built build\windows\x64\runner\Debug Unable to start executable "build\windows\x64\runner\Debug\mogu_flutter.exe": ProcessException: Failed to find "build\windows\x64\runner\Debug\mogu_flutter.exe" in the search path. Command: build\windows\x64\runner\Debug\mogu_flutter.exe ProcessException: Failed to find "build\windows\x64\runner\Debug\mogu_flutter.exe" in the search path. Command: build\windows\x64\runner\Debug\mogu_flutter.exe

给了ai错误,它几顿折腾,就是不行。

两个问题的解决总结:MSB8066,路径不要有中文,计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor 增加个 autorun = chcp 65001。然后删除项目下的windows目录,再flutter create --platforms=windows .

然后还遇到执行 flutter 就卡住,提示是清华的网页的代码。就是flutter run 或者 pub get,upgrade统统不行,但是两个开发计算机,一个行,一个不行。最后是把codebuddy删除了,重新安装解决了。(得删除user目录下相关得东西)

相关推荐
●VON1 天前
鸿蒙Flutter实战:分类管理页BottomSheet CRUD
数据库·flutter·华为·harmonyos·鸿蒙
woodWu1 天前
Flutter 复杂拖拽排序实战:同源排序 + 跨容器拖拽完整落地
flutter
小小小小小鹿1 天前
Vibe Coding 实战:Flutter 自定义路径布局
flutter·vibecoding
程序员老刘2 天前
Dart 3.12 更新要点:乏善可陈
flutter·ai编程·dart
●VON2 天前
鸿蒙Flutter实战:水平滑动分类标签筛选栏
flutter·华为·harmonyos
●VON2 天前
鸿蒙Flutter实战:24小时新建标签提示组件
android·flutter·华为·harmonyos·鸿蒙
●VON2 天前
鸿蒙Flutter实战:MultiProvider多状态管理架构实践
flutter·华为·架构·harmonyos·鸿蒙
●VON2 天前
鸿蒙Flutter实战:放弃sqflite选纯Dart JSON文件存储
flutter·华为·json·harmonyos·鸿蒙
J船长2 天前
把该死的Provider再讲一遍
flutter