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
Copy file name to clipboardExpand all lines: docs/platforms/dart/guides/flutter/troubleshooting.mdx
+74-1Lines changed: 74 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,60 @@ sidebar_order: 9000
6
6
7
7
If you need help solving issues with Sentry's Flutter SDK, you can read the edge cases documented here. If you need additional help, you can [ask on GitHub](https://github.com/getsentry/sentry-dart/issues/new/choose). Customers on a paid plan may also contact support.
8
8
9
+
## Not Enough Stack Frames Captured or the Captured Frames are Unhelpful For Debugging
10
+
11
+
### What's the Problem?
12
+
13
+
When errors occur in your Flutter app, you might notice that some error reports in Sentry don't show you the complete stack trace that led to the error. This missing information can make it harder to pinpoint where the problem originated in your code.
14
+
15
+
### When This Problem Occurs
16
+
17
+
Sentry automatically captures error details and stack traces using Flutter and Dart's built-in error handling such as `FlutterError.onError`. However, sometimes the stack trace information is not available or becomes incomplete, especially when using `async` and `await` in your code.
18
+
19
+
When this happens, Sentry does its best to give you *some* debugging information, for example by calling `StackTrace.current` if there is none given by the `onError` hook, but it might not give you the complete picture.
20
+
21
+
### Example of the Problem
22
+
23
+
Here's a simple example that demonstrates this issue:
24
+
25
+
```dart
26
+
Future<void> tryCatch() async {
27
+
await foo();
28
+
29
+
try {
30
+
throw StateError('try catch');
31
+
} catch (error) {
32
+
// This is only an example, you should not do this in your code
As you can see the stack trace is missing the `foo` and `bar` functions.
55
+
This happens because Dart's async/await implementation can cause stack trace information to be lost during asynchronous operations. This is a known limitation of the Dart runtime itself, not a Sentry issue. You can learn more about this in [this Dart issue](https://github.com/dart-lang/sdk/issues/46318).
56
+
57
+
### What Can You Do?
58
+
59
+
In order to get better debugging information for these cases you can:
60
+
- Add relevant context to your Sentry events using [custom tags](/platforms/dart/guides/flutter/data-management/tags/) and [breadcrumbs](/platforms/dart/guides/flutter/data-management/breadcrumbs/) for critical paths in your application
61
+
- Consider using [Sentry's Structured Logs](/platforms/dart/logs/) to capture additional debugging data alongside your errors
62
+
9
63
## Support 16 KB Page Sizes on Android
10
64
11
65
Starting with Android 15, AOSP supports devices with a 16 KB page size. If your app uses NDK libraries (directly or via an SDK), you'll need to rebuild it for compatibility with these devices.
@@ -21,7 +75,7 @@ Starting May 1, 2024, Apple requires all apps submitted to the App Store to prov
21
75
## Known Limitations
22
76
23
77
- If you enable the `split-debug-info` and `obfuscate` features, you must upload [debug symbols](/platforms/dart/guides/flutter/upload-debug/).
24
-
- Issue titles might be obfuscated as we rely on the `runtimeType`, but they may not be human-readable. See the [Obfuscate Caveat](https://flutter.dev/docs/deployment/obfuscate#caveat).
78
+
- Issue titles might be obfuscated (or minified on web) as we rely on the `runtimeType`, but they may not be human-readable. For iOS and Android, follow the [Sentry Dart Plugin guide](/platforms/dart/guides/flutter/upload-debug/) to set up the obfuscation map which allows us to deobfuscate the issue tile. We’re currently exploring a solution for Web.
25
79
- Layout related errors are only caught by [FlutterError.onError](https://api.flutter.dev/flutter/foundation/FlutterError/onError.html) in debug mode. In release mode, they are removed by the Flutter framework. See [Flutter build modes](https://flutter.dev/docs/testing/build-modes).
26
80
- Use [inbound filters](/concepts/data-management/filtering/) to exclude unhandled errors that are caught outside of your application in release builds. The SDK cannot filter these directly due to obfuscated stack traces.
27
81
- If your app runs on Windows and uses a Flutter version below `3.3.0`, you need to set the version and build number manually, see [this issue on GitHub](https://github.com/flutter/flutter/issues/73652). To do so:
@@ -77,6 +131,25 @@ On Linux, compiling your Flutter Desktop app with the crashpad backend can fail
77
131
78
132
- Update your clang to at least version 13, then try again.
79
133
- If you still encounter errors, please file an issue on our [Sentry Dart GitHub repository](https://github.com/getsentry/sentry-dart/issues/).
134
+
135
+
### Java or JNI Errors when compiling on Flutter Desktop
136
+
137
+
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.
138
+
139
+
However, there's a current limitation: Flutter automatically compiles the Dart JNI plugin for all platforms (iOS, Android, etc.), even when you're only building for one platform.
140
+
141
+
For example on Windows it will compile components such as `dartjni.dll` which requires a JDK (Java Development Kit) to be installed on your system.
142
+
143
+
Ideally it is possible to compile only for the chosen target platform to avoid unnecessary work, but this is currently blocked by [this Dart JNI issue](https://github.com/dart-lang/native/issues/1023).
144
+
145
+
If you run into problems, make sure you have a JDK installed on your computer. We recommend using version 17.
146
+
147
+
<Alertlevel="info">
148
+
149
+
This does not affect your end users. Since we only use JNI code on Android, users on other platforms do not need Java installed.
150
+
The JDK is only necessary as the developer because the Flutter tooling will compile the Dart JNI plugin for all platforms.
151
+
152
+
</Alert>
80
153
81
154
### `SentryFlutter.init` Throws a `sentry_init failed` Error
0 commit comments