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目录下相关得东西)

相关推荐
程序员老刘2 天前
跨平台开发地图 | 2026年6月
flutter·ai编程·客户端
悟空瞎说3 天前
Flutter 架构详解:新手必懂底层原理
flutter
SoaringHeart3 天前
Flutter最佳实践:IM聊天文字链接自动识别跳转
前端·flutter
恋猫de小郭3 天前
KMP / CMP 鸿蒙版本 Beta 发布,他有什么特别之处?
android·前端·flutter
风华圆舞4 天前
Flutter + 鸿蒙 Intents Kit:页面直达能力的完整接入方案
flutter·ui·华为·harmonyos
韩曙亮4 天前
【Flutter】Flutter 组件 ④ ( 组件渲染 的 三棵树理论 | Widget 树 → Element 树 → RenderObject 树 )
flutter·element·widget·renderobject
恋猫de小郭4 天前
Android 17 正式版发布,全新 AI 和各种破坏性更新
android·前端·flutter
kingbal4 天前
Windows:flutter环境搭建
windows·flutter
911hzh4 天前
Flutter MethodChannel 跨端通信框架 zh_native_channel:快速入门、优势分析与 Pigeon 对比
flutter
911hzh4 天前
Flutter 快速搭建新项目:用 Flutter Foundation Kit 一条命令生成带基础架构的 App 模板
flutter