通过 Fastlane 将 dSYMS 上传到 Firebase
Upload dSYMS to Firebase via Fastlane
我很难通过 Fastlane 将 dSYM 文件上传到 Firebase。我有一条如下所示的车道:
desc "Fetch and upload dSYM files to Firebase Crashlytics"
lane :refresh_dsyms_firebase do |options|
download_dsyms(version: options[:version])
upload_symbols_to_crashlytics(gsp_path: "./App/GoogleService-Info.plist")
clean_build_artifacts
end
我确认这是 plist
文件的正确路径,但是当我首先尝试 运行 车道时,我看到以下内容:
[17:22:47]: invalid byte sequence in UTF-8
[17:22:47]: invalid byte sequence in UTF-8
[17:22:47]: invalid byte sequence in UTF-8
然后为找到的每个 dSYM 文件选择其中一个:
[17:22:48]: Uploading '70DBE65E-227E-3754-89F2-EEFA6B8EEC2F.dSYM'...
[17:22:48]: Shell command exited with exit status instead of 0.
我正在尝试确定我在这个过程中到底遗漏了什么。有人有想法吗?我是 Fastlane 的新手,所以我肯定认为我可能会遗漏一些基本的东西。 (虽然,那个空的退出状态有点奇怪)。
快车道 2.107.0
编辑(6 月 7 日:2021 年):
我将自己的答案更新为在撰写本文时对我有帮助的答案。
此页面上还有许多关于使用 Fastlane 的其他很好的答案 - 请查看它们
任何对此感兴趣的人都可以关注这里的话题:https://github.com/fastlane/fastlane/issues/13096
TL;DR: 当你打电话时
upload_symbols_to_crashlytics(gsp_path: "./App/GoogleService-Info.plist")
它将从名为 upload_symbols
的已安装 Fabric pod 调用一个二进制文件,看起来像这样:
./Pods/Fabric/upload-symbols -a db4d085462b3cd8e3ac3b50f118e273f077497b0 -gsp ./App/GoogleService-Info.plist -p ios /private/var/folders/x1/x6nqt4997t38zr9x7zwz72kh0000gn/T/d30181115-8238-1fr38bo/D4CE43B9-9350-3FEE-9E71-9E31T39080CD.dSYM
您会注意到它使用 Fabric API 键和 GoogleService-Info.plist 路径来调用它。我不知道为什么,但这会导致它无法上传。在 运行 快速通道之前,您必须暂时从 Info.plist
文件中删除结构配置信息。 (记得重新添加fabric配置)
这可能不是大多数人的选择,但我只是通过重新开始来解决这个问题。如果你是从 Fabric 过来的,这可能不是很明显,但我想我会撕掉创可贴。我最初的设置是使用 Fabric(Answers)/Firebase Crashlytics,这是 Fabric->Firebase 迁移路径,虽然微妙,但两者之间的配置略有不同并导致 upload_symbols_to_crashlytics
出现问题
- 删除对 Fabric 答案的支持,或替换为 https://firebase.google.com/docs/analytics/ios/start
- 删除
Info.plist
中的 Fabric
声明
- 修改 BuildPhases 中现有的 运行 脚本:将现有的 运行 脚本替换为
"${PODS_ROOT}/Fabric/run"
并将 $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
添加到输入文件
- 在你
AppDelegate
中删除 Fabric.with([Crashlytics.self])
你也可以杀死 import Fabric
因为这现在被 Firebase 覆盖了
- 取消链接结构,重新加入 Firebase crashlytics,以及 select 新集成。
desc "Upload any dsyms in the current directory to crashlytics"
lane :upload_dsyms do |options|
download_dsyms(version: version_number, build_number: build_number)
upload_symbols_to_crashlytics(gsp_path: "./App/Resources/GoogleService-Info.plist")
clean_build_artifacts
end
详情
- Xcode 版本 11.3.1 (11C504)
- Firebase 工具 7.14.0
- 快车道 2.143.0
解决方案
./fastlane/Pluginfile
gem 'fastlane-plugin-firebase_app_distribution'
Lane
before_all do
# Update fastlane
update_fastlane
# Update fastlane plugins
sh("fastlane update_plugins")
# Update firebase tools
sh("curl -sL firebase.tools | upgrade=true bash")
end
用法一.
Download dsyms from AppStore and upload to firebase
download_dsyms(version: '1.0', build_number: '1')
upload_symbols_to_crashlytics(gsp_path: "./App/Environment/production/GoogleService-Info-production.plist")
用法 2.
Get dsyms from archive (after build) and upload to firebase
gym(
configuration: 'Release',
scheme: 'MyApp',
include_bitcode: true
)
upload_symbols_to_crashlytics(gsp_path: "./App/Environment/production/GoogleService-Info-production.plist")
信息
首先,您需要使用 upload_symbols_to_crashlytics
,但在使用它之前,您需要从 App Store Connect 下载您的 dsyms,为此您应该使用带有一些参数的 download_dsyms
[=14] =] 和 build_number
并且 Fastlane 会问你关于你的 app_identifier
所以我建议你使用它在得到你的答案之前不要中断构建。
desc "Upload any dsyms in the current directory to Crashlytics of firebase"
lane :upload_dsyms do |options|
version_number = get_version_number(target: "your_app_target")
build_number = get_build_number
download_dsyms(
app_identifier: "your_app_identifier",
version: version_number,
build_number: build_number
)
upload_symbols_to_crashlytics(gsp_path: "./your_app_name or your_app_target/another_directroy/GoogleService-Info.plist")
clean_build_artifacts
end
我的应用是
desc "Upload any dsyms in the current directory to Crashlytics of firebase"
lane :upload_dsyms do |options|
version_number = get_version_number(target: "Movies")
build_number = get_build_number
download_dsyms(
app_identifier: "com.vngrs.Movies.demo",
version: version_number,
build_number: build_number
)
upload_symbols_to_crashlytics(gsp_path: "./Movies/Resources/GoogleService-Info.plist")
clean_build_artifacts
end
这对我有用
desc "Downlaod and Uplaod dSYMS to Firebase"
lane :uplaod_dsyms do
download_dsyms # This will download all version
upload_symbols_to_crashlytics(
gsp_path: "Path to your google plist",
binary_path: "./Pods/FirebaseCrashlytics/upload-symbols") # this goes to cocoapods of FirebaseCrashlytics
clean_build_artifacts # Delete the local dSYM files
end
这对我有用。
1.在 Fastfile
上创建一个新通道
# Fastfile
default_platform(:ios)
# Constants
XCODE_PROJECT = "PROJECT.xcodeproj"
XCODE_WORKSPACE = "PROJECT.xcworkspace"
PRODUCTION_GSP_PATH = "./APP_ROOT/GoogleService-Info.plist"
platform :ios do
desc "Push a production build to TestFlight"
lane :upload_crashlytics_prod do
download_dsyms(
version: get_version_number(xcodeproj: XCODE_PROJECT),
build_number: get_build_number(xcodeproj: XCODE_PROJECT)
)
upload_symbols_to_crashlytics(gsp_path: PRODUCTION_GSP_PATH)
end
end
2。现在从您的 shell 脚本或终端调用
fastlane upload_crashlytics_prod
我很难通过 Fastlane 将 dSYM 文件上传到 Firebase。我有一条如下所示的车道:
desc "Fetch and upload dSYM files to Firebase Crashlytics"
lane :refresh_dsyms_firebase do |options|
download_dsyms(version: options[:version])
upload_symbols_to_crashlytics(gsp_path: "./App/GoogleService-Info.plist")
clean_build_artifacts
end
我确认这是 plist
文件的正确路径,但是当我首先尝试 运行 车道时,我看到以下内容:
[17:22:47]: invalid byte sequence in UTF-8
[17:22:47]: invalid byte sequence in UTF-8
[17:22:47]: invalid byte sequence in UTF-8
然后为找到的每个 dSYM 文件选择其中一个:
[17:22:48]: Uploading '70DBE65E-227E-3754-89F2-EEFA6B8EEC2F.dSYM'...
[17:22:48]: Shell command exited with exit status instead of 0.
我正在尝试确定我在这个过程中到底遗漏了什么。有人有想法吗?我是 Fastlane 的新手,所以我肯定认为我可能会遗漏一些基本的东西。 (虽然,那个空的退出状态有点奇怪)。
快车道 2.107.0
编辑(6 月 7 日:2021 年): 我将自己的答案更新为在撰写本文时对我有帮助的答案。
此页面上还有许多关于使用 Fastlane 的其他很好的答案 - 请查看它们
任何对此感兴趣的人都可以关注这里的话题:https://github.com/fastlane/fastlane/issues/13096
TL;DR: 当你打电话时
upload_symbols_to_crashlytics(gsp_path: "./App/GoogleService-Info.plist")
它将从名为 upload_symbols
的已安装 Fabric pod 调用一个二进制文件,看起来像这样:
./Pods/Fabric/upload-symbols -a db4d085462b3cd8e3ac3b50f118e273f077497b0 -gsp ./App/GoogleService-Info.plist -p ios /private/var/folders/x1/x6nqt4997t38zr9x7zwz72kh0000gn/T/d30181115-8238-1fr38bo/D4CE43B9-9350-3FEE-9E71-9E31T39080CD.dSYM
您会注意到它使用 Fabric API 键和 GoogleService-Info.plist 路径来调用它。我不知道为什么,但这会导致它无法上传。在 运行 快速通道之前,您必须暂时从 Info.plist
文件中删除结构配置信息。 (记得重新添加fabric配置)
这可能不是大多数人的选择,但我只是通过重新开始来解决这个问题。如果你是从 Fabric 过来的,这可能不是很明显,但我想我会撕掉创可贴。我最初的设置是使用 Fabric(Answers)/Firebase Crashlytics,这是 Fabric->Firebase 迁移路径,虽然微妙,但两者之间的配置略有不同并导致 upload_symbols_to_crashlytics
- 删除对 Fabric 答案的支持,或替换为 https://firebase.google.com/docs/analytics/ios/start
- 删除
Info.plist
中的 - 修改 BuildPhases 中现有的 运行 脚本:将现有的 运行 脚本替换为
"${PODS_ROOT}/Fabric/run"
并将$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
添加到输入文件 - 在你
AppDelegate
中删除Fabric.with([Crashlytics.self])
你也可以杀死import Fabric
因为这现在被 Firebase 覆盖了
- 取消链接结构,重新加入 Firebase crashlytics,以及 select 新集成。
Fabric
声明
desc "Upload any dsyms in the current directory to crashlytics"
lane :upload_dsyms do |options|
download_dsyms(version: version_number, build_number: build_number)
upload_symbols_to_crashlytics(gsp_path: "./App/Resources/GoogleService-Info.plist")
clean_build_artifacts
end
详情
- Xcode 版本 11.3.1 (11C504)
- Firebase 工具 7.14.0
- 快车道 2.143.0
解决方案
./fastlane/Pluginfile
gem 'fastlane-plugin-firebase_app_distribution'
Lane
before_all do
# Update fastlane
update_fastlane
# Update fastlane plugins
sh("fastlane update_plugins")
# Update firebase tools
sh("curl -sL firebase.tools | upgrade=true bash")
end
用法一.
Download dsyms from AppStore and upload to firebase
download_dsyms(version: '1.0', build_number: '1')
upload_symbols_to_crashlytics(gsp_path: "./App/Environment/production/GoogleService-Info-production.plist")
用法 2.
Get dsyms from archive (after build) and upload to firebase
gym(
configuration: 'Release',
scheme: 'MyApp',
include_bitcode: true
)
upload_symbols_to_crashlytics(gsp_path: "./App/Environment/production/GoogleService-Info-production.plist")
信息
首先,您需要使用 upload_symbols_to_crashlytics
,但在使用它之前,您需要从 App Store Connect 下载您的 dsyms,为此您应该使用带有一些参数的 download_dsyms
[=14] =] 和 build_number
并且 Fastlane 会问你关于你的 app_identifier
所以我建议你使用它在得到你的答案之前不要中断构建。
desc "Upload any dsyms in the current directory to Crashlytics of firebase"
lane :upload_dsyms do |options|
version_number = get_version_number(target: "your_app_target")
build_number = get_build_number
download_dsyms(
app_identifier: "your_app_identifier",
version: version_number,
build_number: build_number
)
upload_symbols_to_crashlytics(gsp_path: "./your_app_name or your_app_target/another_directroy/GoogleService-Info.plist")
clean_build_artifacts
end
我的应用是
desc "Upload any dsyms in the current directory to Crashlytics of firebase"
lane :upload_dsyms do |options|
version_number = get_version_number(target: "Movies")
build_number = get_build_number
download_dsyms(
app_identifier: "com.vngrs.Movies.demo",
version: version_number,
build_number: build_number
)
upload_symbols_to_crashlytics(gsp_path: "./Movies/Resources/GoogleService-Info.plist")
clean_build_artifacts
end
这对我有用
desc "Downlaod and Uplaod dSYMS to Firebase"
lane :uplaod_dsyms do
download_dsyms # This will download all version
upload_symbols_to_crashlytics(
gsp_path: "Path to your google plist",
binary_path: "./Pods/FirebaseCrashlytics/upload-symbols") # this goes to cocoapods of FirebaseCrashlytics
clean_build_artifacts # Delete the local dSYM files
end
这对我有用。
1.在 Fastfile
上创建一个新通道# Fastfile
default_platform(:ios)
# Constants
XCODE_PROJECT = "PROJECT.xcodeproj"
XCODE_WORKSPACE = "PROJECT.xcworkspace"
PRODUCTION_GSP_PATH = "./APP_ROOT/GoogleService-Info.plist"
platform :ios do
desc "Push a production build to TestFlight"
lane :upload_crashlytics_prod do
download_dsyms(
version: get_version_number(xcodeproj: XCODE_PROJECT),
build_number: get_build_number(xcodeproj: XCODE_PROJECT)
)
upload_symbols_to_crashlytics(gsp_path: PRODUCTION_GSP_PATH)
end
end
2。现在从您的 shell 脚本或终端调用
fastlane upload_crashlytics_prod