Skip to content

Commit eacc24c

Browse files
authored
crashlytics update (#3333)
* crashlytics update * added a note
1 parent 26c3d19 commit eacc24c

File tree

1 file changed

+62
-50
lines changed

1 file changed

+62
-50
lines changed

content/knowledge-firebase/firebase-crashlytics-dsym-uploading.md

Lines changed: 62 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,64 @@ A sample project for uploading **dSYM** files to Firebase Crashlytics can be fou
1313

1414
### How to upload dSYM artifacts to Firebase Crashlytics using codemagic.yaml
1515

16-
In order to generate debug symbols, Firebase Crashlytics must be installed using the following script in your `codemagic.yaml`:
16+
Flutter automatically generates the app’s dSYM file when building an iOS archive with:
1717

1818
{{< highlight yaml "style=paraiso-dark">}}
19-
scripts:
20-
- name: Install Firebase Crashlytics
21-
script: |
22-
flutter pub add firebase_crashlytics
19+
flutter build ipa
2320
{{< /highlight >}}
2421

22+
or
2523

26-
Alternatively, **firebase_crashlytics: ^2.5.2** could be added in the **pubspec.yaml** file under **dependencies**:
24+
{{< highlight yaml "style=paraiso-dark">}}
25+
flutter build ios --release
26+
{{< /highlight >}}
27+
28+
Crashlytics must also be added to your app:
29+
{{< highlight yaml "style=paraiso-dark">}}
30+
flutter pub add firebase_crashlytics
31+
32+
{{< /highlight >}}
33+
34+
or by adding **firebase_crashlytics** dependency manually in the **pubspec.yaml** file:
2735

2836
{{< highlight yaml "style=paraiso-dark">}}
2937
dependencies:
3038
flutter:
3139
sdk: flutter
32-
firebase_crashlytics: ^2.5.2
40+
firebase_crashlytics: ^latest
3341
{{< /highlight >}}
3442

3543

3644
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:
3745

3846
{{< highlight yaml "style=paraiso-dark">}}
39-
artifacts:
40-
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
47+
artifacts:
48+
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
4149
{{< /highlight >}}
4250

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

4553
{{< highlight yaml "style=paraiso-dark">}}
4654
publishing:
47-
scripts:
48-
- name: Upload debug symbols to Firebase Crashlytics
49-
script: |
50-
echo "Find build artifacts"
51-
dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive -name "*.dSYM" | head -1)
52-
if [[ -z ${dsymPath} ]]
53-
then
54-
echo "No debug symbols were found, skip publishing to Firebase Crashlytics"
55-
else
56-
echo "Publishing debug symbols from $dsymPath to Firebase Crashlytics"
57-
ls -d -- ios/Pods/*
58-
$CM_BUILD_DIR/ios/Pods/FirebaseCrashlytics/upload-symbols \
59-
-gsp ios/Runner/GoogleService-Info.plist -p ios $dsymPath
60-
fi
55+
scripts:
56+
echo "Locating dSYM artifacts..."
57+
dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive/dSYMs -name "Runner.app.dSYM" | head -1)
58+
59+
if [[ -z "$dsymPath" ]]; then
60+
echo "No app dSYM file found, skipping upload."
61+
else
62+
echo "Uploading dSYM file: $dsymPath"
63+
$CM_BUILD_DIR/ios/Pods/FirebaseCrashlytics/upload-symbols \
64+
-gsp ios/Runner/GoogleService-Info.plist \
65+
-p ios "$dsymPath"
66+
fi
67+
6168
{{< /highlight >}}
69+
70+
{{<notebox>}}
71+
**Note:** The sample path uses `Runner.xcarchive` because Flutter iOS projects use `Runner` as the default app target.
72+
If your project was renamed or you manually changed the iOS target name, make sure to update the path accordingly.
73+
{{</notebox>}}
6274

6375
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:
6476

@@ -83,41 +95,41 @@ If necessary, you can use remote access to the build machine to find the correct
8395
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:
8496

8597
{{< highlight yaml "style=paraiso-dark">}}
86-
publishing:
87-
scripts:
88-
- name: Upload debug symbols to Firebase Crashlytics
89-
script: |
90-
echo "Find build artifacts"
91-
dsymPath=$(find build/ios/xcarchive/* | head -1)
92-
echo "dsyms expected in:"
93-
ls -d -- $dsymPath/dSYMs/*
94-
dsymFile=$(find $dsymPath/dSYMs -name "*.dSYM" | head -1)
95-
if [[ -z ${dsymFile} ]]
96-
then
97-
echo "No debug symbols were found, skip publishing to Firebase Crashlytics"
98-
else
99-
echo "Publishing debug symbols in $dsymFile to Firebase Crashlytics"
100-
echo $dsymFile
101-
ls -d -- $CM_BUILD_DIR/*
102-
$HOME/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols \
103-
-gsp $CM_BUILD_DIR/<PATH_TO_YOUR_GoogleService-Info.plist> -p ios $dsymFile
104-
fi
98+
publishing:
99+
scripts:
100+
- name: Upload debug symbols to Firebase Crashlytics
101+
script: |
102+
echo "Find build artifacts"
103+
dsymPath=$(find build/ios/xcarchive/* | head -1)
104+
echo "dsyms expected in:"
105+
ls -d -- $dsymPath/dSYMs/*
106+
dsymFile=$(find $dsymPath/dSYMs -name "*.dSYM" | head -1)
107+
if [[ -z ${dsymFile} ]]
108+
then
109+
echo "No debug symbols were found, skip publishing to Firebase Crashlytics"
110+
else
111+
echo "Publishing debug symbols in $dsymFile to Firebase Crashlytics"
112+
echo $dsymFile
113+
ls -d -- $CM_BUILD_DIR/*
114+
$HOME/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols \
115+
-gsp $CM_BUILD_DIR/<PATH_TO_YOUR_GoogleService-Info.plist> -p ios $dsymFile
116+
fi
105117
{{< /highlight >}}
106118

107119
### How to upload dSYM artifacts to Firebase Crashlytics using Workflow Editor
108120

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

111123
{{< highlight yaml "style=paraiso-dark">}}
112-
echo "Find build artifacts"
113-
dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive -name "*.dSYM" | head -1)
114-
if [[ -z ${dsymPath} ]]
115-
then
116-
echo "No debug symbols were found, skip publishing to Firebase Crashlytics"
124+
echo "Locating dSYM artifacts..."
125+
dsymPath=$(find $CM_BUILD_DIR/build/ios/archive/Runner.xcarchive/dSYMs -name "Runner.app.dSYM" | head -1)
126+
127+
if [[ -z "$dsymPath" ]]; then
128+
echo "No app dSYM file found, skipping upload."
117129
else
118-
echo "Publishing debug symbols from $dsymPath to Firebase Crashlytics"
119-
ls -d -- ios/Pods/*
130+
echo "Uploading dSYM file: $dsymPath"
120131
$CM_BUILD_DIR/ios/Pods/FirebaseCrashlytics/upload-symbols \
121-
-gsp ios/Runner/GoogleService-Info.plist -p ios $dsymPath
132+
-gsp ios/Runner/GoogleService-Info.plist \
133+
-p ios "$dsymPath"
122134
fi
123135
{{< /highlight >}}

0 commit comments

Comments
 (0)