From 117be9ae47e06d2fd96fe36c0063224c35ee3a06 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 20 Nov 2025 10:11:38 +0100 Subject: [PATCH] crashlytics update --- .../firebase-crashlytics-dsym-uploading.md | 107 ++++++++++-------- 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/content/knowledge-firebase/firebase-crashlytics-dsym-uploading.md b/content/knowledge-firebase/firebase-crashlytics-dsym-uploading.md index 0e4e3ebdf..ffe564cb8 100644 --- a/content/knowledge-firebase/firebase-crashlytics-dsym-uploading.md +++ b/content/knowledge-firebase/firebase-crashlytics-dsym-uploading.md @@ -13,51 +13,58 @@ A sample project for uploading **dSYM** files to Firebase Crashlytics can be fou ### How to upload dSYM artifacts to Firebase Crashlytics using codemagic.yaml -In order to generate debug symbols, Firebase Crashlytics must be installed using the following script in your `codemagic.yaml`: +Flutter automatically generates the app’s dSYM file when building an iOS archive with: {{< highlight yaml "style=paraiso-dark">}} - scripts: - - name: Install Firebase Crashlytics - script: | - flutter pub add firebase_crashlytics +flutter build ipa {{< /highlight >}} +or -Alternatively, **firebase_crashlytics: ^2.5.2** could be added in the **pubspec.yaml** file under **dependencies**: +{{< highlight yaml "style=paraiso-dark">}} +flutter build ios --release +{{< /highlight >}} + +Crashlytics must also be added to your app: +{{< highlight yaml "style=paraiso-dark">}} +flutter pub add firebase_crashlytics + +{{< /highlight >}} + +or by adding **firebase_crashlytics** dependency manually in the **pubspec.yaml** file: {{< highlight yaml "style=paraiso-dark">}} dependencies: flutter: sdk: flutter - firebase_crashlytics: ^2.5.2 + firebase_crashlytics: ^latest {{< /highlight >}} 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: {{< highlight yaml "style=paraiso-dark">}} - artifacts: - - $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM +artifacts: + - $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM {{< /highlight >}} In order to upload the dSYM files to Firebase Crashlytics, add the following script to your `codemagic.yaml` configuration file: {{< highlight yaml "style=paraiso-dark">}} publishing: - scripts: - - name: Upload debug symbols to Firebase Crashlytics - script: | - echo "Find build artifacts" - dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive -name "*.dSYM" | head -1) - if [[ -z ${dsymPath} ]] - then - echo "No debug symbols were found, skip publishing to Firebase Crashlytics" - else - echo "Publishing debug symbols from $dsymPath to Firebase Crashlytics" - ls -d -- ios/Pods/* - $CM_BUILD_DIR/ios/Pods/FirebaseCrashlytics/upload-symbols \ - -gsp ios/Runner/GoogleService-Info.plist -p ios $dsymPath - fi + 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 + {{< /highlight >}} 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: @@ -83,25 +90,25 @@ If necessary, you can use remote access to the build machine to find the correct 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: {{< highlight yaml "style=paraiso-dark">}} -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/ -p ios $dsymFile - fi + 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/ -p ios $dsymFile + fi {{< /highlight >}} ### How to upload dSYM artifacts to Firebase Crashlytics using Workflow Editor @@ -109,15 +116,15 @@ publishing: In order to upload the dSYM files to Firebase Crashlytics, add the following script to your **post-publish** script in the Flutter workflow editor: {{< highlight yaml "style=paraiso-dark">}} - echo "Find build artifacts" - dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive -name "*.dSYM" | head -1) - if [[ -z ${dsymPath} ]] - then - echo "No debug symbols were found, skip publishing to Firebase Crashlytics" + 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 "Publishing debug symbols from $dsymPath to Firebase Crashlytics" - ls -d -- ios/Pods/* + echo "Uploading dSYM file: $dsymPath" $CM_BUILD_DIR/ios/Pods/FirebaseCrashlytics/upload-symbols \ - -gsp ios/Runner/GoogleService-Info.plist -p ios $dsymPath + -gsp ios/Runner/GoogleService-Info.plist \ + -p ios "$dsymPath" fi {{< /highlight >}} \ No newline at end of file