Flutter ios Build 无法在 MacOS Big Sur 11.0 Beta 上运行
Posted
技术标签:
【中文标题】Flutter ios Build 无法在 MacOS Big Sur 11.0 Beta 上运行【英文标题】:Flutter ios Build not working on MacOS Big Sur 11.0 Beta 【发布时间】:2021-01-12 19:22:09 【问题描述】:在 MacOS BigSur Beta 上,我正在尝试生成 ios 版本,但这总是给我以下错误。
我尝试重新安装 Flutter,安装到 beta、dev 或 master 并使用 Xcode beta,但没有任何效果。
如果有人遇到同样的问题,请帮助我并解决。
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.3.1/ext/json/ext/generator
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200926-66152-11vu3z5.rb extconf.rb
creating Makefile
current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.3.1/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.3.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: note: did not find header 'config.h' in framework 'ruby' (loaded from '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks')
1 error generated.
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/json-2.3.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/json-2.3.1/gem_make.out
【问题讨论】:
【参考方案1】:让我们尝试安装旧版本的 cocoapods。
-
卸载 cocoapods
安装旧版本的cocoapods (e.g. 1.8.0)
sudo gem install cocoapods --version '=1.8.0' -n /usr/local/bin
扑干净
发布获取
运行您的项目(iOS 模拟器)
我使用此过程解决了错误。
【讨论】:
使用 macOs Big Sur Flutter 有什么问题或变化吗?以上是关于Flutter ios Build 无法在 MacOS Big Sur 11.0 Beta 上运行的主要内容,如果未能解决你的问题,请参考以下文章
Flutter iOS混编 解决flutter在iOS14+ debug模式上无法运行的问题
Flutter XCode-build 错误无法构建模块'firebase_core'
Flutter 图像选择器在带有 Mac M1 芯片模拟器的 ios 14 中不起作用
Flutter 在执行 Flutter build ios 后卡在 Building Dart 代码上
为啥flutter build ios --obfuscate --split-debug-info= 失败并出现警告,但flutter build ios 有效?