[英]Unable to build iOS or Android app after upgrade to Flutter 3.0
After upgrading to Flutter 3.0 I am no longer able to build any of my apps for either iOS or Android and get the same errors in both builds:升级到 Flutter 3.0 后,我无法再为 iOS 或 Android 构建我的任何应用程序,并且在两个构建中都出现相同的错误:
: Error: Member not found: 'UnicodeChar'.
int get UnicodeChar => Char.UnicodeChar;
^^^^^^^^^^^
: Error: Setter not found: 'UnicodeChar'.
set UnicodeChar(int value) => Char.UnicodeChar = value;
^^^^^^^^^^^
: Error: Member not found: 'AsciiChar'.
int get AsciiChar => Char.AsciiChar;
^^^^^^^^^
: Error: Setter not found: 'AsciiChar'.
set AsciiChar(int value) => Char.AsciiChar = value;
^^^^^^^^^
and these errors are in the file "src/structs.g.dart" (part of Flutter/Dart as far as I can tell) as follows:这些错误在文件“src/structs.g.dart”(据我所知是 Flutter/Dart 的一部分)中,如下所示:
/// {@category Struct}
class _CHAR_INFO__Char_e__Union extends Union {
@Uint16()
external int UnicodeChar;
@Uint8()
external int AsciiChar;
}
extension CHAR_INFO_Extension on CHAR_INFO {
int get UnicodeChar => Char.UnicodeChar;
set UnicodeChar(int value) => Char.UnicodeChar = value;
int get AsciiChar => Char.AsciiChar;
set AsciiChar(int value) => Char.AsciiChar = value;
}
I am running VSCode 1.67.1 on macOS Monterey 12.3.1 and flutter doctor -v
shows no errors found.我在 macOS Monterey 12.3.1 和
flutter doctor -v
上运行 VSCode 1.67.1 显示没有发现错误。
It appears that the file "src/structs.g.dart" seems to be part of the Win32 components in "pub.dartlang.org" but I am not building my apps for Windows (yet).看起来文件“src/structs.g.dart”似乎是“pub.dartlang.org”中 Win32 组件的一部分,但我还没有为 Windows(还)构建我的应用程序。
Any ideas on what I need to do to be able to build for iOS and Android again will be much appreciated.对于我需要做什么才能再次构建 iOS 和 Android 的任何想法,我们将不胜感激。
Thanks谢谢
Les莱斯
So, something which helped me:所以,对我有帮助的东西:
/Users/your-user/.pub-cache/hosted/pub.dartlang.org
/Users/your-user/.pub-cache/hosted/pub.dartlang.org
flutter pub upgrade
flutter pub upgrade
and then try to run your project然后尝试运行你的项目
Steps to solve your problem:解决问题的步骤:
First Of all, You Need To Update all Third-party Packages首先,您需要更新所有第三方包
flutter pub upgrade --major-versions flutter 发布升级 --major-versions
Now You need to clean your project现在你需要清理你的项目
flutter clean flutter 清洁
Delete "pubspec.lock" file at the root of your project (manually or run the script)删除项目根目录下的“pubspec.lock”文件(手动或运行脚本)
rm -rf pubspec.lock rm -rf pubspec.lock
Now, You need to Get all Packages现在,您需要获取所有包
flutter pub get flutter 酒吧得到
Now you can run your project and the error should be solved;)现在你可以运行你的项目了,错误应该已经解决了;)
Step 1: Delete pod folder in ios.第一步:删除ios中的pod文件夹。
Step 2: uncomment the code at the line # platform:ios, '9.0' in Podfile.第 2 步:取消注释 Podfile 中 # platform:ios, '9.0' 行的代码。
Step 3: change line platform:ios, '9.0' to platform:ios, '10.0'第 3 步:将线路 platform:ios, '9.0' 更改为 platform:ios, '10.0'
Step 4: run: flutter pub upgrade
第四步:运行:
flutter pub upgrade
Step 5: cd ios, run pod install
第五步:cd ios,运行
pod install
Step 6: run pod repo update
and sudo gem install cocoapods
and run again pod repo update
and run pod install
第 6 步:运行
pod repo update
和sudo gem install cocoapods
并再次运行pod repo update
并运行pod install
Step 7: run again project.第七步:再次运行项目。 goodluck
祝你好运
Delete the build folder, run flutter clean.删除构建文件夹,运行 flutter clean。 I had the same problem with a macOS project and had to delete the macOs folder.
我在 macOS 项目中遇到了同样的问题,不得不删除 macOs 文件夹。 Works fine afterwards.
之后工作正常。
Downgrade flutter to the previous version "flutter downgrade" until an upgrade to flutter 3.0.0 is provided by the owners of all packages you are using in your project.将 flutter 降级到以前的版本“flutter downgrade”,直到升级到 flutter 3.0.0 由您在项目中使用的所有包的所有者提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.