Firebase Crashlytics dSYM uploading

Enhancing Crash Log Debugging with dSYM files

dSYM files store the debug symbols for your app. They contain mapping information to decode a stack-trace into a readable format. The purpose of dSYM is to replace symbols in the crash logs with the specific methods so it will be readable and helpful for debugging the crash.

A sample project for uploading dSYM files to Firebase Crashlytics can be found in our Sample projects repository.

How to upload dSYM artifacts to Firebase Crashlytics using codemagic.yaml

Flutter automatically generates the app’s dSYM file when building an iOS archive with:

flutter build ipa

or

flutter build ios --release

Crashlytics must also be added to your app:

flutter pub add firebase_crashlytics

or by adding firebase_crashlytics dependency manually in the pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  firebase_crashlytics: ^latest

As soon as your build finishes successfully, debug symbols are generated. However, if you want them to be displayed in the Codemagic UI on the build page, then the following path needs to be configured in codemagic.yaml under the artifacts section:

artifacts:
  - $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM

In order to upload the dSYM files to Firebase Crashlytics, add the following script to your codemagic.yaml configuration file:

publishing:
  scripts: 
      echo "Locating dSYM artifacts..."
      dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive/dSYMs -name "Runner.app.dSYM" | head -1)

      if [[ -z "$dsymPath" ]]; then
        echo "No app dSYM file found, skipping upload."
      else
        echo "Uploading dSYM file: $dsymPath"
        $CM_BUILD_DIR/ios/Pods/FirebaseCrashlytics/upload-symbols \
          -gsp ios/Runner/GoogleService-Info.plist \
          -p ios "$dsymPath"
      fi
Note: The sample path uses Runner.xcarchive because Flutter iOS projects use Runner as the default app target.
If your project was renamed or you manually changed the iOS target name, make sure to update the path accordingly.

The above-mentioned dsymPath is Flutter specific and it could change depending on what platform the app is built on. For example, in React Native or Native iOS applications you might use the dsymPath as:

dsymPath=$(find $CM_BUILD_DIR/build/ios/xcarchive/*.xcarchive -name "*.dSYM" | head -1)

Besides, as Pods is not located inside the ios directory for native iOS apps, the following path needs to be changed as well:

ls -d -- ios/Pods/*

to

ls -d -- $CM_BUILD_DIR/*

If necessary, you can use remote access to the build machine to find the correct path. More information can be found here.

For Native iOS apps, in the case of using SwiftPackageManager (SPM) instead of CocoaPods, the following script needs to be added in a post-publishing script:

  publishing:
    scripts:
      - name: Upload debug symbols to Firebase Crashlytics
        script: | 
          echo "Find build artifacts"
          dsymPath=$(find build/ios/xcarchive/* | head -1)
          echo "dsyms expected in:"
          ls -d -- $dsymPath/dSYMs/*
          dsymFile=$(find $dsymPath/dSYMs -name "*.dSYM" | head -1) 
          if [[ -z ${dsymFile} ]]
            then
              echo "No debug symbols were found, skip publishing to Firebase Crashlytics"
            else
              echo "Publishing debug symbols in $dsymFile to Firebase Crashlytics"
              echo $dsymFile
              ls -d -- $CM_BUILD_DIR/*
              $HOME/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols \
                -gsp $CM_BUILD_DIR/<PATH_TO_YOUR_GoogleService-Info.plist> -p ios $dsymFile
          fi

How to upload dSYM artifacts to Firebase Crashlytics using Workflow Editor

In order to upload the dSYM files to Firebase Crashlytics, add the following script to your post-publish script in the Flutter workflow editor:

  echo "Locating dSYM artifacts..."
  dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive/dSYMs -name "Runner.app.dSYM" | head -1)

  if [[ -z "$dsymPath" ]]; then
    echo "No app dSYM file found, skipping upload."
  else
    echo "Uploading dSYM file: $dsymPath"
    $CM_BUILD_DIR/ios/Pods/FirebaseCrashlytics/upload-symbols \
      -gsp ios/Runner/GoogleService-Info.plist \
      -p ios "$dsymPath"
  fi