0%

修复'Flutter/Flutter.h' file not found 报错问题总结

今天上午Flutter在iOS上运行的好好的,中间因为电脑自动重启,再次打开时,就报了这个错误:’Flutter/Flutter.h’ file not found,于是乎,我以为很简单的一波操作就OK了,

1
2
3
4
5
6
7
8
9
flutter upgrade

flutter clean

flutter packages get

flutter build ios

// 最后 Xcode中 command+B

然而,’Flutter/Flutter.h’ file not found 报错依然存在,不仅如此,还报了这个问题。

1
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:

搜索一下得知,在ios/profile加上:

1
2
3
4
pre_install do |installer|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

那’Flutter/Flutter.h’ file not found 怎么解决呢?

在项目目录下面 ios/Flutter 文件夹,用以前的无报错文件替换掉 ios/Flutter 文件夹内容,再执行。

1
flutter build ios --release

重新生成新的 iOS/Flutter 文件夹下内容,覆盖我们替换的文件

到这里,你以为好了吗?NO,来看看这个报错。

1
/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory

解决:用xcode 打开 Runner.xcworkspace,找到工程文件:Runner->PROJECT 注意是PROJECT,而不是TARGET哦,如下图的修改:

欢迎关注公众号:flutter_todo,有更多技术干货和学习资源教程分享。

qrcode_for_gh_a1ca9094adfb_430