You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Learn more about uploading debug symbols for both Android, iOS/macOS, and Flutter Web."
3
+
description: "Learn more about uploading debug symbols for Android, iOS/macOS, and Flutter Web."
4
4
sidebar_order: 2
5
5
---
6
6
@@ -18,56 +18,166 @@ For Flutter Desktop (Windows/Linux) `split-debug-info` and `obfuscate` flags are
18
18
19
19
Errors raised from the native layer in Flutter apps require certain debug information files to be uploaded. For example, an Android app can use `proguard` for minification and obfuscation. And when using NDK, dwarf debug files need to be uploaded. Flutter Web requires sourcemaps and iOS apps also require dwarf debug information files.
20
20
21
-
## Automatically Upload Debug Symbols
21
+
## Sentry Dart Plugin
22
22
23
-
The easiest way to upload debug symbols is to use the [Sentry Dart Plugin](https://github.com/getsentry/sentry-dart-plugin) which will upload them automatically.
23
+
The easiest way to upload debug symbols, source maps, and use source context is to use the [Sentry Dart Plugin](https://github.com/getsentry/sentry-dart-plugin) which will upload them automatically.
24
24
25
-
### Install
25
+
### 1. Install
26
26
27
27
In your `pubspec.yaml`, add `sentry_dart_plugin` as a new dev dependency.
The Sentry Dart Plugin comes with a default configuration but requires you to set the `project`, `org`, and `auth_token` fields to use it.
37
37
38
-
- `flutter build apk`
39
-
- `flutter build ios`(or `macos`), or
40
-
- `flutter build web`
38
+
Add the following to your `pubspec.yaml` file:
39
+
40
+
```yaml {filename: pubspec.yaml}
41
+
sentry:
42
+
project: ___PROJECT_SLUG___
43
+
org: ___ORG_SLUG___
44
+
auth_token: ___ORG_AUTH_TOKEN___
45
+
```
46
+
47
+
<Note>
41
48
42
-
before executing the `sentry_dart_plugin` plugin.
49
+
The option `upload_debug_symbols` is enabled by default. That means the plugin will automatically upload debug symbols for all platforms except Flutter Web.
43
50
44
-
This build step outputs the debug symbols and source maps that the plugin will upload.
51
+
</Note>
52
+
53
+
#### Source Maps
54
+
55
+
By default, source maps are not uploaded. In order to upload source maps, you need to set the `upload_source_maps` field to `true`.
45
56
46
-
### Configure
57
+
```yaml {filename: pubspec.yaml} {5}
58
+
sentry:
59
+
project: ___PROJECT_SLUG___
60
+
org: ___ORG_SLUG___
61
+
auth_token: ___ORG_AUTH_TOKEN___
62
+
upload_source_maps: true
63
+
```
47
64
48
-
This Sentry Dart Plugin comes with a default configuration.
65
+
#### Source Context
49
66
50
-
To modify this configuration, add a `sentry:` configuration to the end of your `pubspec.yaml` file:
67
+
By default, sources are not uploaded. In order to upload sources, you need to set the `upload_sources` field to `true`.
51
68
52
-
```yaml
69
+
```yaml {filename: pubspec.yaml} {5}
53
70
sentry:
54
-
upload_debug_symbols: true
55
-
upload_source_maps: false
56
-
upload_sources: false
57
-
project: ...
58
-
org: ...
59
-
auth_token: ...
60
-
url: ...
61
-
wait_for_processing: false
62
-
log_level: error
63
-
release: ...
64
-
dist: ...
65
-
web_build_path: ...
66
-
commits: auto
67
-
ignore_missing: true
71
+
project: ___PROJECT_SLUG___
72
+
org: ___ORG_SLUG___
73
+
auth_token: ___ORG_AUTH_TOKEN___
74
+
upload_sources: true
75
+
76
+
```
77
+
78
+
<Note>
79
+
80
+
This uploads the source files of the Dart/Flutter code, not the native code.
81
+
If you want to use source context for native code, you need to setup source context in the respective native platform.
82
+
83
+
</Note>
84
+
85
+
In addition to configuring the plugin in the `pubspec.yaml` file, the plugin supports using a properties file or environment variables.
86
+
For more information, read the [Sentry Dart Plugin README](https://github.com/getsentry/sentry-dart-plugin/tree/main?tab=readme-ov-file#configuration-optional).
87
+
88
+
### 3. Build
89
+
90
+
Run one of the following commands before executing the `sentry_dart_plugin` plugin.
91
+
If you choose to obfuscate your build, include the `--obfuscate` flag along with the `--split-debug-info` option to specify the directory for storing debug information.
For Flutter web run `flutter build web --release --source-maps` to generate source maps.
106
+
107
+
</Note>
108
+
109
+
### 4. Run
110
+
111
+
Now we can run the plugin to upload the debug symbols, source maps, and sources (if enabled).
112
+
113
+
```bash
114
+
flutter packages pub run sentry_dart_plugin
115
+
```
116
+
117
+
<Note>
118
+
119
+
If you choose not to obfuscate your build, the plugin will not upload debug symbols but will still configure source context if enabled.
120
+
121
+
</Note>
122
+
123
+
### Proguard
124
+
125
+
If you have ProGuard (`minifyEnabled`) enabled, you must upload the [Android Proguard/R8 mapping files](/platforms/android/enhance-errors/proguard) to see complete stack traces.
126
+
127
+
In order to upload debug symbols for ProGuard obfuscated native Android code you have two options:
128
+
1. Use the [Sentry Android Gradle Plugin](/platforms/android/configuration/gradle/)
129
+
2. Use the [Sentry CLI](/cli/dif/#uploading-files)
130
+
131
+
The Sentry Android Gradle Plugin is the simpler and recommended way to upload debug symbols for Android.
132
+
133
+
After installing the Sentry Android Gradle Plugin, you need to set `autoInstallation` to `false` in your `app/build.gradle` file:
134
+
135
+
```groovy {filename: app/build.gradle}
136
+
sentry {
137
+
autoInstallation {
138
+
enabled = false
139
+
}
140
+
}
68
141
```
69
142
70
-
#### Available Configuration Fields
143
+
Sentry Flutter already ships with a compatible Sentry Android SDK, so we need to disable the auto-installation which could cause conflicts with the packaged Sentry Android SDK.
144
+
145
+
After setting up the gradle plugin, follow the [Android Gradle Plugin guide](/platforms/android/configuration/gradle/#proguardr8--dexguard) on how to upload Proguard mapping files.
146
+
147
+
## Manually Upload Debug Symbols
148
+
149
+
If you have an obfuscated build and you decide not to use the Sentry Dart Plugin, you can manually upload debug symbols for Android, iOS/macOS, Flutter Web.
150
+
151
+
You will need to upload the following files:
152
+
-[dSYM files](/platforms/android/data-management/debug-files/file-formats/#mach-o-and-dsym) (`*.dSYM`) for iOS and macOS
153
+
-[Flutter generated symbols](https://docs.flutter.dev/deployment/obfuscate#obfuscate-your-app) (`*.symbols`) for Android and [ELF](/platforms/android/data-management/debug-files/file-formats/#executable-and-linkable-format-elf) for Android NDK
154
+
- Source Maps (`*.map`) for Web
155
+
156
+
### iOS and macOS
157
+
158
+
Sentry requires a dSYM upload to symbolicate your crash logs. The symbolication process unscrambles Apple’s crash logs to reveal the function, file names, and line numbers of the crash. [Learn how to upload the dSYM files](/platforms/apple/dsym/).
159
+
160
+
### Android
161
+
162
+
See our docs on uploading [Debug Information Files](/cli/dif/#uploading-files) manually with the Sentry CLI.
163
+
164
+
### Android NDK
165
+
166
+
See our docs on uploading [Debug Information Files](/cli/dif/#uploading-files) manually with the Sentry CLI.
167
+
168
+
If you're using a version of `sentry_flutter` earlier than 5.1, native symbolication on Android requires a specific configuration. Refer to [Troubleshooting](/platforms/flutter/troubleshooting/#native-symbolication-on-android) for more information.
169
+
170
+
<Note>
171
+
172
+
Sentry's Flutter SDK doesn't currently support the `uploadNativeSymbols` flag from the [Sentry Gradle Plugin](/platforms/android/configuration/gradle/).
173
+
174
+
</Note>
175
+
176
+
### Web
177
+
178
+
See our docs on uploading [Source Maps](/cli/releases/#upload-source-maps) manually.
179
+
180
+
## Configuration Fields
71
181
72
182
`project`
73
183
@@ -139,46 +249,6 @@ Path to the sentry-cli binary to use instead of downloading. Make sure to use th
139
249
140
250
Alternative place to download sentry-cli. This is a `string` type with default value `https://downloads.sentry-cdn.com/sentry-cli`. Alternatively, this can also be set with the `SENTRYCLI_CDNURL` environment variable.
141
251
142
-
### Run
143
-
144
-
```bash
145
-
flutter packages pub run sentry_dart_plugin
146
-
```
147
-
148
-
### Troubleshooting
252
+
## Troubleshooting
149
253
150
254
Refer to [Troubleshooting - Sentry Dart Plugin](/platforms/flutter/troubleshooting#sentry-dart-plugin) to resolve potential issues.
151
-
152
-
## Manually Upload Debug Symbols
153
-
154
-
### Uploading for iOS and macOS
155
-
156
-
Sentry requires a dSYM upload to symbolicate your crash logs. The symbolication process unscrambles Apple’s crash logs to reveal the function, file names, and line numbers of the crash. [Learn how to upload the dSYM files](/platforms/apple/dsym/).
157
-
158
-
If you use the `split-debug-info` and `obfuscate` flags, you need to upload the `*.dSYM` files instead of the `*.symbols` files generated by the Flutter build. The `*.dSYM` files are located in the `build` folder of your project and not the given `split-debug-info` folder.
159
-
160
-
### Uploading for Android NDK
161
-
162
-
The Sentry Dart Plugin will also upload NDK symbols if `upload_debug_symbols` is enabled. Alternatively, see our docs on uploading [Debug Information Files](/cli/dif/#uploading-files) manually with the Sentry CLI.
163
-
164
-
If you are using a version of `sentry_flutter` earlier than 5.1, native symbolication on Android requires a specific configuration. Refer to [Troubleshooting](/platforms/flutter/troubleshooting/#native-symbolication-on-android) for more information.
165
-
166
-
<Note>
167
-
168
-
Sentry's Flutter SDK doesn't currently support the `uploadNativeSymbols` flag from the [Sentry Gradle Plugin](/platforms/android/configuration/gradle/).
169
-
170
-
</Note>
171
-
172
-
### Uploading with ProGuard
173
-
174
-
If you have ProGuard (`minifyEnabled`) enabled, you must upload the [Android Proguard/R8 mapping files](/platforms/android/enhance-errors/proguard/) to see complete stack traces. You can upload these files by either using our Gradle integration (recommended) or manually by using the [Sentry CLI](/cli/dif/#proguard-mapping-upload).
175
-
176
-
### Uploading Source Maps for Flutter Web
177
-
178
-
The Sentry Dart plugin also uploads source maps if `upload_source_maps` is enabled. Alternatively, you can use the Sentry CLI to upload your source maps for Flutter Web by following the docs on [Managing Release Artifacts](/cli/releases/#managing-release-artifacts).
179
-
180
-
### Uploading Source Context
181
-
182
-
Use the [`upload_sources`](/platforms/flutter/upload-debug/#sentry-dart-plugin) option to enable [Source Context](/platforms/flutter/data-management/debug-files/source-context/). This is available for Flutter Android, iOS, macOS and Web.
183
-
184
-
For more information, check out the [Native Symbolication on iOS/macOS](/platforms/flutter/troubleshooting/#native-symbolication-on-iosmacos) and [Source Context](/platforms/flutter/troubleshooting/#source-context) troubleshooting guides.
0 commit comments