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

相关推荐
西西学代码17 小时前
Flutter---Notification(2)
flutter
TE-茶叶蛋19 小时前
Windows安装Flutter开发环境
windows·flutter
西西学代码19 小时前
Flutter---认识-Notification
flutter
西西学代码20 小时前
Flutter---Notification(1.基础通知)
flutter
灰鲸广告联盟1 天前
APP广告变现定制化解决方案,助力收益提升与用户体验平衡
android·flutter·搜索引擎·ux
L、2181 天前
Flutter + OpenHarmony + 区块链:构建去中心化身份认证系统(DID 实战)
flutter·华为·去中心化·区块链·harmonyos
西西学代码1 天前
Flutter---右滑显示删除按钮
flutter
kirk_wang1 天前
Flutter app_settings 库在鸿蒙(OHOS)平台的适配实践与解析
flutter·移动开发·跨平台·arkts·鸿蒙
小a彤1 天前
Flutter 原生开发指南
flutter
L、2181 天前
Flutter + OpenHarmony 全栈实战:打造“鸿蒙智联”智能家居控制中心(系列终章)
flutter·华为·智能手机·electron·智能家居·harmonyos