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

相关推荐
A懿轩A2 小时前
【2025最新】Flutter 编译开发 鸿蒙HarmonyOS 6 项目教程(Windows)
windows·flutter·华为·openharmony·开源鸿蒙
忆江南6 小时前
🔥 一句话解释 SNI
flutter
WaterFly6 小时前
Flutter入门概览4-UI入门篇
flutter
未来猫咪花6 小时前
告别卡顿和耗电!view_model 的 Pause 机制如何拯救你的 Flutter 应用
flutter
metaRTC8 小时前
webRTC IPC客户端Flutter版编程指南
flutter·webrtc·ipc
liuxf12348 小时前
鸿蒙Flutter,No Hmos SDK found.
flutter·华为·harmonyos
西西学代码14 小时前
Flutter---Listview横向滚动列表(1)
flutter
XI锐真的烦17 小时前
Flutter Windows 下“Running Gradle task ‘assembleDebug‘...” 卡住一整天的终极解决办法
windows·flutter
苦逼的搬砖工1 天前
基于 easy_rxdart 的轻量响应式与状态管理架构实践
android·flutter