美文网首页
iOS和Flutter混编问题:Library not load

iOS和Flutter混编问题:Library not load

作者: Kegem | 来源:发表于2022-01-26 15:51 被阅读0次

    1、解决方案

    更新rubycocoapods
    flutter中也有人提出问题,也给出了解决方案Issues

    2、Ruby

    • 查看当前ruby版本
    ruby -v
    
    • 升级ruby环境(升级ruby需要借助rvm,需要先安装rvm)
    1. curl -L  https://get.rvm.io | bash -s stable
    2. source ~/.rvm/scripts/rvm
    
    • 升级rvm使用命令
    rvm get stable
    
    • 获取ruby版本列表
    rvm list known
    

    结果:

    # MRI Rubies
    [ruby-]1.8.6[-p420]
    [ruby-]1.8.7[-head] # security released on head
    [ruby-]1.9.1[-p431]
    [ruby-]1.9.2[-p330]
    [ruby-]1.9.3[-p551]
    [ruby-]2.0.0[-p648]
    [ruby-]2.1[.10]
    [ruby-]2.2[.10]
    [ruby-]2.3[.8]
    [ruby-]2.4[.10]
    [ruby-]2.5[.8]
    [ruby-]2.6[.6]
    [ruby-]2.7[.2]
    [ruby-]3[.0.0]
    ruby-head
    

    此时可以根据自己的需要安装指定版本的ruby。

    rvm install 3.0.0
    
    • 如果报错unknown or unsupported macOS version: :dunno (MacOSVersionError),执行:
    brew update-reset
    

    成功后再执行rvm install 3.0.0

    • 查看镜像
    gem sources -l
    

    结果

    *** CURRENT SOURCES ***
    
    https://gems.ruby-china.com
    

    如果结果不一致,可以更换镜像源

    sudo gem update --system
    // 删除现有镜像源
    gem sources --remove https://rubygems.org/
    // 新增新的镜像源
    gem sources --add https://gems.ruby-china.com/
    

    3、Cocoapods

    • 安装cocoapods
    // 10.11以前
    sudo gem install cocoapods
    
    // 10.11 之后
    sudo gem install -n /usr/local/bin cocoapods
    

    安装结果:

    Fetching xcodeproj-1.21.0.gem
    Fetching nanaimo-0.3.0.gem
    Fetching colored2-3.1.2.gem
    Fetching claide-1.1.0.gem
    Fetching CFPropertyList-3.0.5.gem
    Fetching atomos-0.1.3.gem
    Fetching ruby-macho-2.5.1.gem
    Fetching nap-1.1.0.gem
    Fetching molinillo-0.8.0.gem
    Fetching gh_inspector-1.1.3.gem
    Fetching fourflusher-2.3.1.gem
    Fetching escape-0.0.4.gem
    Fetching cocoapods-try-1.2.0.gem
    Fetching netrc-0.11.0.gem
    Fetching cocoapods-trunk-1.6.0.gem
    Fetching cocoapods-search-1.0.1.gem
    Fetching cocoapods-plugins-1.0.0.gem
    Fetching public_suffix-4.0.6.gem
    Fetching concurrent-ruby-1.1.9.gem
    Fetching cocoapods-downloader-1.5.1.gem
    Fetching cocoapods-deintegrate-1.0.5.gem
    Fetching ffi-1.15.5.gem
    Fetching ethon-0.15.0.gem
    Fetching typhoeus-1.4.0.gem
    Fetching fuzzy_match-2.0.4.gem
    Fetching addressable-2.8.0.gem
    Fetching httpclient-2.8.3.gem
    Fetching cocoapods-core-1.11.2.gem
    Fetching algoliasearch-1.27.5.gem
    Fetching cocoapods-1.11.2.gem
    Fetching zeitwerk-2.5.3.gem
    Fetching tzinfo-2.0.4.gem
    Fetching i18n-1.8.11.gem
    Fetching activesupport-6.1.4.4.gem
    Successfully installed nanaimo-0.3.0
    Successfully installed colored2-3.1.2
    Successfully installed claide-1.1.0
    Successfully installed CFPropertyList-3.0.5
    Successfully installed atomos-0.1.3
    Successfully installed xcodeproj-1.21.0
    Successfully installed ruby-macho-2.5.1
    Successfully installed nap-1.1.0
    Successfully installed molinillo-0.8.0
    Successfully installed gh_inspector-1.1.3
    Successfully installed fourflusher-2.3.1
    Successfully installed escape-0.0.4
    Successfully installed cocoapods-try-1.2.0
    Successfully installed netrc-0.11.0
    Successfully installed cocoapods-trunk-1.6.0
    Successfully installed cocoapods-search-1.0.1
    Successfully installed cocoapods-plugins-1.0.0
    Successfully installed cocoapods-downloader-1.5.1
    Successfully installed cocoapods-deintegrate-1.0.5
    Building native extensions. This could take a while...
    Successfully installed ffi-1.15.5
    Successfully installed ethon-0.15.0
    Successfully installed typhoeus-1.4.0
    Successfully installed public_suffix-4.0.6
    Successfully installed fuzzy_match-2.0.4
    Successfully installed concurrent-ruby-1.1.9
    Successfully installed httpclient-2.8.3
    A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
    Successfully installed algoliasearch-1.27.5
    Successfully installed addressable-2.8.0
    Successfully installed zeitwerk-2.5.3
    Successfully installed tzinfo-2.0.4
    Successfully installed i18n-1.8.11
    Successfully installed activesupport-6.1.4.4
    Successfully installed cocoapods-core-1.11.2
    Successfully installed cocoapods-1.11.2
    Parsing documentation for nanaimo-0.3.0
    Installing ri documentation for nanaimo-0.3.0
    Parsing documentation for colored2-3.1.2
    Installing ri documentation for colored2-3.1.2
    Parsing documentation for claide-1.1.0
    Installing ri documentation for claide-1.1.0
    Parsing documentation for CFPropertyList-3.0.5
    Installing ri documentation for CFPropertyList-3.0.5
    Parsing documentation for atomos-0.1.3
    Installing ri documentation for atomos-0.1.3
    Parsing documentation for xcodeproj-1.21.0
    Installing ri documentation for xcodeproj-1.21.0
    Parsing documentation for ruby-macho-2.5.1
    Installing ri documentation for ruby-macho-2.5.1
    Parsing documentation for nap-1.1.0
    Installing ri documentation for nap-1.1.0
    Parsing documentation for molinillo-0.8.0
    Installing ri documentation for molinillo-0.8.0
    Parsing documentation for gh_inspector-1.1.3
    Installing ri documentation for gh_inspector-1.1.3
    Parsing documentation for fourflusher-2.3.1
    Installing ri documentation for fourflusher-2.3.1
    Parsing documentation for escape-0.0.4
    Installing ri documentation for escape-0.0.4
    Parsing documentation for cocoapods-try-1.2.0
    Installing ri documentation for cocoapods-try-1.2.0
    Parsing documentation for netrc-0.11.0
    Installing ri documentation for netrc-0.11.0
    Parsing documentation for cocoapods-trunk-1.6.0
    Installing ri documentation for cocoapods-trunk-1.6.0
    Parsing documentation for cocoapods-search-1.0.1
    Installing ri documentation for cocoapods-search-1.0.1
    Parsing documentation for cocoapods-plugins-1.0.0
    Installing ri documentation for cocoapods-plugins-1.0.0
    Parsing documentation for cocoapods-downloader-1.5.1
    Installing ri documentation for cocoapods-downloader-1.5.1
    Parsing documentation for cocoapods-deintegrate-1.0.5
    Installing ri documentation for cocoapods-deintegrate-1.0.5
    Parsing documentation for ffi-1.15.5
    Installing ri documentation for ffi-1.15.5
    Parsing documentation for ethon-0.15.0
    Installing ri documentation for ethon-0.15.0
    Parsing documentation for typhoeus-1.4.0
    Installing ri documentation for typhoeus-1.4.0
    Parsing documentation for public_suffix-4.0.6
    Installing ri documentation for public_suffix-4.0.6
    Parsing documentation for fuzzy_match-2.0.4
    Installing ri documentation for fuzzy_match-2.0.4
    Parsing documentation for concurrent-ruby-1.1.9
    Installing ri documentation for concurrent-ruby-1.1.9
    Parsing documentation for httpclient-2.8.3
    Installing ri documentation for httpclient-2.8.3
    Parsing documentation for algoliasearch-1.27.5
    Installing ri documentation for algoliasearch-1.27.5
    Parsing documentation for addressable-2.8.0
    Installing ri documentation for addressable-2.8.0
    Parsing documentation for zeitwerk-2.5.3
    Installing ri documentation for zeitwerk-2.5.3
    Parsing documentation for tzinfo-2.0.4
    Installing ri documentation for tzinfo-2.0.4
    Parsing documentation for i18n-1.8.11
    Installing ri documentation for i18n-1.8.11
    Parsing documentation for activesupport-6.1.4.4
    Installing ri documentation for activesupport-6.1.4.4
    Parsing documentation for cocoapods-core-1.11.2
    Installing ri documentation for cocoapods-core-1.11.2
    Parsing documentation for cocoapods-1.11.2
    Installing ri documentation for cocoapods-1.11.2
    Done installing documentation for nanaimo, colored2, claide, CFPropertyList, atomos, xcodeproj, ruby-macho, nap, molinillo, gh_inspector, fourflusher, escape, cocoapods-try, netrc, cocoapods-trunk, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, ffi, ethon, typhoeus, public_suffix, fuzzy_match, concurrent-ruby, httpclient, algoliasearch, addressable, zeitwerk, tzinfo, i18n, activesupport, cocoapods-core, cocoapods after 24 seconds
    34 gems installed
    
    
    • 如果电脑上存在多个Xcode,会报错误
    Building native extensions. This could take a while...
    ERROR:  Error installing cocoapods:
        ERROR: Failed to build gem native extension.
    

    要指定默认的Xcode

    // 通过应用程序中选取指定的Xcode拖拽到终端,生成后面的链接
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
    

    指定完后再继续更新cocoapods

    sudo gem install -n /usr/local/bin cocoapods
    

    结语

    更新完后,再去build后,重新pod install后真机运行试试。。。

    相关文章

      网友评论

          本文标题:iOS和Flutter混编问题:Library not load

          本文链接:https://www.haomeiwen.com/subject/stunhrtx.html