Upload dSYMS to Firebase via Fastlane
Asked Answered
K

7

17

I am struggling to upload dSYM files to Firebase via Fastlane. I have a lane that looks like the following:

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

I confirmed that that is the correct path to the plist file, but when I try to run the lane at first I see the following:

[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

and then one of these for every dSYM file found:

[17:22:48]: Uploading '70DBE65E-227E-3754-89F2-EEFA6B8EEC2F.dSYM'...
[17:22:48]: Shell command exited with exit status  instead of 0.

I am trying to determine exactly what I am missing from this process. Does anyone have ideas? I am fairly new to Fastlane, so definitely assume I could be missing something basic. (Although, that empty exit status is a bit weird).

fastlane 2.107.0

EDIT(June 7th: 2021): I updated the answer from my own to one that was helpful to me at the time this was written.

There are many other great answers on this page on using Fastlane as well - please check them out

Kohn answered 29/10, 2018 at 16:29 Comment(4)
I'm experiencing the same issue, any updates on this?Garonne
@Garonne nope. still happening. there should be a github issue for fastlane about something similar i commented onKohn
Any update on this?Valaree
@EvertonCunha see the answer i just addedKohn
B
14

This may not be an option for most, but I just ended up fixing this by starting over. It may not be entirely obvious if you came over from Fabric, but I figured I would just rip off the band aid. My original setup was using the Fabric(Answers)/Firebase Crashlytics which is the Fabric->Firebase migration path, although subtle, the configuration between the two are slightly different and cause issues with upload_symbols_to_crashlytics

  1. Remove support for Fabric answers, or replace with https://firebase.google.com/docs/analytics/ios/start
  2. Remove the Fabric declaration in Info.plist
  3. Modify your existing run script in BuildPhases: replace your existing runscript with "${PODS_ROOT}/Fabric/run" and add $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) to input files
  4. In you AppDelegate remove Fabric.with([Crashlytics.self]) and you can also kill the import Fabric as this is now covered by Firebase
  5. Unlink fabric, re-onboard Firebase crashlytics, and select new integration.
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
Bozen answered 3/1, 2019 at 8:2 Comment(5)
Gonna give this a try - if it works i'll switch the correct answer to yours. Just a quick clarity, did you mean to say remove import firebase or remove import fabric?Kohn
Opps, import fabric, fixing nowBozen
It's basically purging the awkward bridged integration and starting fresh. If you aren't using Answers, it's not a huge deal and greatly simplifies configuration. The legacy fabric environment variable was causing an incorrect branch in fastlane, but instead of hacking around it, I decided an unbridged "Firebase 1st" install was the right move. I've dropped my dependency on Answers long ago, so this bridge was just adding unnecessary complexity.Bozen
Wait, Ryan, will this break any production builds already out from reporting correctly?Kohn
@Kohn negative, you just won't see them in your firebase dashboard. I have legacy fabric in the wild, no issues. I made sure to run inventory before i unlinked, so I was aware of all the existing crashes. Basically they were never reporting to firebase in the first place, they were being bridged between servicesBozen
K
9

anyone interested in this can follow the thread here: https://github.com/fastlane/fastlane/issues/13096

TL;DR: When you call

upload_symbols_to_crashlytics(gsp_path: "./App/GoogleService-Info.plist")

It will call a binary from the installed Fabric pod called upload_symbols and will look something like this:

./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

You'll notice that it calls it using both the Fabric API key and the GoogleService-Info.plist path. I do not know why but this will cause it not to upload. You'll have to temporarily remove the fabric configuration information from your Info.plist file before running the fastlane lane. (remember to re-add the fabric configuration).

Kohn answered 20/12, 2018 at 18:5 Comment(0)
S
5

First, you need to use upload_symbols_to_crashlytics but before to use it you will need to download your dsyms from App Store Connect and to do that you should use download_dsyms with some parameters version and build_number and the Fastlane will ask you about your app_identifier so I advise you to use it to not interrupt the build until getting your answer.

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

my app was

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
Scan answered 15/6, 2020 at 22:11 Comment(0)
W
2

Details

  • Xcode Version 11.3.1 (11C504)
  • Firebase tools 7.14.0
  • Fastlane 2.143.0

Solution

./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

Usage 1.

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")

Usage 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")

Info

Wellhead answered 11/3, 2020 at 14:4 Comment(0)
A
1

This works for me.

1. Create a new lane on 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. Now call from your shell script or terminal

fastlane upload_crashlytics_prod
Allahabad answered 26/8, 2021 at 6:55 Comment(0)
B
0

This worked for me

  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
Bede answered 27/5, 2021 at 22:16 Comment(0)
F
0

I want to help others who might face this issue. In this case, there can be various problems. I also faced a similar issue, but my problem was different.

Question: How can I find out what's causing the problem?

Answer: In the upload_symbols_to_crashlytics lane, add the debug: true option. This will allow you to debug your issue. In my case, the problem was with connectivity access, and I fixed it.

from Armenia.

Francinefrancis answered 22/7 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.