Skip to content

Commit c1cff1a

Browse files
denrasebuenaflor
andauthored
docs(flutter): document Android flavor workaround for split-debug-info (#17268)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR Add a troubleshooting entry for Flutter flavor builds that can overwrite the selected flavor’s Dart symbol files and break Android symbolication. Relates to getsentry/sentry-dart-plugin#379 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## EXTRA RESOURCES [Sentry Dart Plugin Issue](getsentry/sentry-dart-plugin#379) --------- Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
1 parent f613039 commit c1cff1a

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

docs/platforms/dart/guides/flutter/troubleshooting.mdx

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,47 @@ The `--split-debug-info` option requires setting an output directory. The direct
119119

120120
Flutter's `build web` command requires setting the `--source-maps` parameter to generate source maps. See [Flutter GitHub Issue](https://github.com/flutter/flutter/issues/72150#issuecomment-755541599) for more information.
121121

122+
### Symbolication issues with `--split-debug-info` and Android flavors
123+
124+
<Alert>Affected versions: Flutter 3.32.0 and later</Alert>
125+
126+
When using Android product flavors together with `--split-debug-info`, Flutter/Gradle may compile another release flavor and overwrite the selected flavor's `.symbols` files. This can leave you with mismatched or unusable debug symbols.
127+
128+
#### Workaround
129+
130+
1. In `android/app/build.gradle.kts`, ignore release variants you are not actively building. This prevents another flavor from overwriting the selected flavor's symbols.
131+
2. Pass the active flavor in the build command so Gradle only keeps the variant you want.
132+
133+
```kotlin
134+
android {
135+
variantFilter {
136+
// Only keep the selected release flavor to avoid split-debug-info
137+
// being overwritten by other release variants.
138+
if (buildType?.name != "release") return@variantFilter
139+
140+
val activeFlavor = (project.findProperty("active-flavor") as String?)
141+
?.lowercase()
142+
?: return@variantFilter
143+
144+
val variantFlavors = flavors.map { flavor -> flavor.name.lowercase() }
145+
if (activeFlavor !in variantFlavors) {
146+
ignore = true
147+
}
148+
}
149+
}
150+
```
151+
152+
Build with matching values for `--flavor` and `active-flavor`:
153+
154+
```bash
155+
flutter build appbundle \
156+
--flavor=googlePlay \
157+
--target=lib/main_googlePlay.dart \
158+
--obfuscate \
159+
--split-debug-info=debug_info/googlePlay \
160+
--android-project-arg=active-flavor=googlePlay
161+
```
162+
122163
## Issues with native crashes on Linux and/or Windows
123164

124165
By default the Sentry Flutter SDK will enable native crash reporting on Linux and Windows with `crashpad`.
@@ -131,7 +172,7 @@ On Linux, compiling your Flutter Desktop app with the crashpad backend can fail
131172

132173
- Update your clang to at least version 13, then try again.
133174
- If you still encounter errors, please file an issue on our [Sentry Dart GitHub repository](https://github.com/getsentry/sentry-dart/issues/).
134-
175+
135176
### Java or JNI Errors when compiling on Flutter Desktop
136177

137178
Since Sentry Flutter SDK version `9.0.0`, we improved how the SDK works on Android by switching from method channels to JNI (Java Native Interface) for certain operations.

0 commit comments

Comments
 (0)