Firebase Flutter 接入
环境:mac M1
下载安装firebase
curl -sL https://firebase.tools | bash
关联谷歌账号(需将自己的账号加入到项目后台)
firebase login
激活配置
dart pub global activate flutterfire_cli
在NewAPP目录下执行
flutterfire configure --project=newlive-8ac4f
Firebase初始化
flutter pub add firebase_core
flutterfire configure
如果找不到命令flutterfire则执行或添加到环境变量
export PATH="$PATH":"$HOME/.pub-cache/bin"
错误处理
Unhandled exception:
Exception: /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require': cannot load such file -- xcodeproj (LoadError)
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'
from -e:1:in `<main>'
#0 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:540:11)
<asynchronous suspension>
#1 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#2 main (file:///Users/dxm/.pub-cache/hosted/pub.dev/flutterfire_cli-0.2.7/bin/flutterfire.dart:57:5)
<asynchronous suspension>
m1设备出现错误执行指令 首先升级ruby
Brew install ruby
然后添加新版本的ruby到环境变量
open -e ~/.bash_profile
source ~/.bash_profile
执行
sudo gem install cocoapods && pod install
参考
https://mac.install.guide/faq/do-not-use-mac-system-ruby/index.html
https://firebase.google.com/docs/flutter/setup?hl=zh&authuser=0&platform=ios#available-plugins