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

相关推荐
MonkeyKing71551 小时前
Flutter路由高级管理实战:守卫、深链、多栈与Tab路由全解析
flutter
里欧跑得慢20 小时前
CSS 嵌套:编写更优雅的样式代码
前端·css·flutter·web
里欧跑得慢20 小时前
CSS变量与自定义属性详解
前端·css·flutter·web
xmdy58661 天前
Flutter+开源鸿蒙实战|校园易生活Day1 项目初始化搭建+开发环境校验+工程目录规范+第三方库集成+多端屏幕适配+全局底部导航
flutter·开源·harmonyos
MonkeyKing1 天前
Flutter国际化与多主题实战:多场景示例,一键适配多语言+多风格
flutter
MonkeyKing1 天前
iOS设计模式
flutter
xmdy58661 天前
Flutter+开源鸿蒙实战|校园易生活Day2 第三方库批量集成+全局Toast提示+网络状态监听+首页轮播图+资讯卡片布局
flutter·开源·harmonyos
恋猫de小郭1 天前
Flutter 3.44 发布前夕,官方宣布 SwiftPM 将完全取代 CocoaPods
android·前端·flutter
张风捷特烈1 天前
状态管理大乱斗#06 | Riverpod 源码评析 (下) - 外功心法
android·前端·flutter
神奇的程序员1 天前
开发了一个管理本地开发环境的软件
前端·flutter