通过Fastlane将dSYMS上传到Firebase

时间:2018-10-29 16:29:13

标签: firebase continuous-integration 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相当陌生,因此绝对可以假设我会缺少一些基本知识。 (尽管,退出状态为空有点奇怪。)

fastlane 2.107.0

5 个答案:

答案 0 :(得分:1)

详细信息

  • Xcode版本11.3.1(11C504)
  • Firebase工具7.14.0
  • Fastlane 2.143.0

解决方案

./ fastlane / Pluginfile

gem 'fastlane-plugin-firebase_app_distribution'

车道

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

用法1。

从AppStore下载dsym,然后上传到firebase

download_dsyms(version: '1.0', build_number: '1')
upload_symbols_to_crashlytics(gsp_path: "./App/Environment/production/GoogleService-Info-production.plist")

用法2。

从存档中获取dsym(在构建后)并上传到firebase

gym(
    configuration: 'Release',
    scheme: 'MyApp',
    include_bitcode: true
   )
upload_symbols_to_crashlytics(gsp_path: "./App/Environment/production/GoogleService-Info-production.plist")

信息

答案 1 :(得分:1)

首先,您需要使用upload_symbols_to_crashlytics,但在使用它之前,您需要从App Store Connect下载dsym,为此,您应该使用带有某些参数download_dsyms的{​​{1}}和version,Fastlane会询问您有关build_number的问题,因此我建议您使用它在获得答案之前不要中断构建。

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

答案 2 :(得分:0)

对此感兴趣的任何人都可以关注以下主题:https://github.com/fastlane/fastlane/issues/13096

TL; DR:致电时

upload_symbols

它将从安装的名为./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容器中调用二进制文件,并且看起来像这样:

Info.plist

您会注意到它使用Fabric API密钥和GoogleService-Info.plist路径来调用它。我不知道为什么,但是这将导致它不上传。在运行快速通道之前,您必须从class PerksSerializer < ActiveModel::Serializer attributes :id, :status, :scope, :business_name, :business_description, :business_address_street, :business_address_state, :business_address_city, :business_address_postal_code, :business_website, :latitude, :longitude, :headline, :description, :start_date, :end_date, :redemption_instructions, :cashier_instructions, :redemption_button_text, :claim_type, :business_manager_approved_by, :created_at belongs_to :primary_business_category belongs_to :secondary_business_category end 文件中临时删除结构配置信息。 (请记住要重新添加结构配置)。

答案 3 :(得分:0)

对于大多数人来说,这可能不是一个选择,但是我只是从头开始解决了这个问题。如果您是从Fabric过来的,这可能并不十分明显,但我认为我只是撕下创可贴。我最初的设置是使用Fabric(Answers)/ Firebase Crashlytics,它是Fabric-> Firebase的迁移路径,尽管很微妙,但两者之间的配置略有不同,并导致upload_symbols_to_crashlytics

出现问题
  1. 删除对Fabric答案的支持,或替换为https://firebase.google.com/docs/analytics/ios/start
  2. 删除Fabric中的Info.plist声明
  3. 在BuildPhases中修改现有的运行脚本:将现有的运行脚本替换为"${PODS_ROOT}/Fabric/run",然后将$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)添加到输入文件中
  4. 在您AppDelegate中删除Fabric.with([Crashlytics.self]),您也可以杀死import Fabric,因为Firebase现在已经覆盖了它。
  5. 取消链接结构,重新安装Firebase crashlytics,然后选择新的集成。
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

答案 4 :(得分:0)

这对我有用

  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