我有一个具有不同风格的 Flutter 项目,每种风格使用不同的 Firebase 项目。
我仅使用 dart 初始化,并且我的项目中没有任何
GoogleService-Info.plist
文件。
这工作得很好,除非我想为不同的风格配置 Firebase Crashlytics。特别是上传 dSYM 文件的 XCode 构建阶段脚本。默认(由 FlutterFire cli 配置)脚本使用
firebase_app_id.json
文件中指定的 Google App Id。这样,我所有的风格都会将 dSYM 文件上传到一个 firebase 项目。
我尝试覆盖这个构建脚本并根据我正在构建的风格设置不同的Google应用程序ID,但是我似乎无权访问此脚本中使用的XCode方案,所以我不知道如何确定我应该使用什么 Google 应用程序 ID。
#!/bin/sh
# Determine the flavor
FLAVOR="flavor1" # Change this to match your actual flavor
# Set the Google App ID based on the flavor
case $FLAVOR in
"flavor1")
GOOGLE_APP_ID="your_google_app_id_for_flavor1"
;;
"flavor2")
GOOGLE_APP_ID="your_google_app_id_for_flavor2"
;;
# Add cases for other flavors as needed
*)
echo "Unknown flavor: $FLAVOR"
exit 1
;;
esac
# Replace the following line with the command to upload dSYM files
echo "Uploading dSYM files for flavor $FLAVOR to Firebase project $GOOGLE_APP_ID"
# Example: upload_dsym_command --app_id=$GOOGLE_APP_ID ...
风味:更改值以匹配您正在构建的风味。
GOOGLE_APP_ID: 根据风格设置合适的 Google App ID。
案例陈述:根据风味确定Google App ID。
上传命令: 将占位符替换为将 dSYM 文件上传到 Firebase 的实际命令。