• Dev Flutter with firebase on a M1 Mac


    I had some issues with using firebase, google_sign_in plugin with flutter on M1 MacBook Pro.

    I had tried so many methods but neither of them worked.

    Here i got some errors when building iOS apps with Flutter (firebase and google_sign_in plugin)

        /Users/alex/development/flutter_apps/time_tracker_flutter_course/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m:20:9: fatal error: could not build module 'GoogleDataTransport'
        #import <GoogleDataTransport/GoogleDataTransport.h>
         ~~~~~~~^
        9 errors generated.
        note: Using new build system
        note: Planning
        note: Build preparation complete
        note: Building targets in dependency order
    Could not build the application for the simulator.
    Error launching application on iPhone 13.
    

    As you can see it lacks of *.h header files.  

    I wrote a tutorial before , here: 

    Using Flutter 2 on M1 MacOS Apple Silicon

    Yes it works well. But if I want to use google_sign_in plugin and firebase, I will have some compiling error.

    you need to install homebrew firstly.

    Source from: https://codecrew.codewithchris.com/t/solved-install-cocoapod-on-m1-mac-sudo-gem-install-ffi-fail/15648

    Then reinstall it.

    brew reinstall libffi
    # or
    brew install libffi

    Then

    # uninstall using gem, which comes with macOS
    sudo gem uninstall cocoapods
    # reinstall using homebrew. it comes with a command-line tool called: pod
    brew install cocoapods

    Then go to you flutter app

    flutter clean
    flutter pub get

    Then run without debug from your vscode editor of the Flutter project.

    Check the Debug Console.

    You can compile and run the app successfully.

    If you see some error like this when you are using Flutter and Firebase, google_sign_in plugin,

    IPHONEOS_DEPLOYMENT_TARGET is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99

    Go here: https://developer.apple.com/forums/thread/656616

    https://github.com/firebase/firebase-ios-sdk/issues/6533#issuecomment-711066130

    and here: 
    Xcode 12 drops support for iOS 8 and how to fix deployment target warnings in CocoaPods

    https://www.jessesquires.com/blog/2020/07/20/xcode-12-drops-support-for-ios-8-fix-for-cocoapods/

    I'm using Xcode 13.2.1, simulator iPhone 13, iOS 15.2

    I changed the Podfile to be

    # platform :ios, '9.0'
    platform :ios, '12.0'


    ...

    post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' end end end

    Because I hardcode it to be ios 12.

    Yes. Minimum ios support down to 12. It's year 2022 now.

  • 相关阅读:
    网络编程中 TCP 半开连接和TIME_WAIT 学习
    redis中的小秘密和持久化小细节
    排序
    Es官方文档整理-3.Doc Values和FieldData
    Es官方文档整理-2.分片内部原理
    Elasticsearch doc_value认识
    路边停靠 贴边停车不蹭轮胎的技巧
    mybatis 连接数据库
    putIfAbsent
    Hive与HBase区别 大墨垂杨
  • 原文地址:https://www.cnblogs.com/spaceship9/p/15845784.html
Copyright © 2020-2023  润新知