Skip to content

fix(jni): update proguard rules #3036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

### Unreleased

### Fixes

- Replay JNI usage with `SentryFlutterPlugin` ([#3036](https://github.com/getsentry/sentry-dart/pull/3036))

## 9.3.0

### Breaking Change (Tooling)
Expand Down
7 changes: 7 additions & 0 deletions flutter/android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
-keep class io.sentry.flutter.** { *; }

# Keep replay integration classes used by JNI
-keep class io.sentry.android.replay.** { *; }
Comment on lines 1 to +4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is merged but maybe worth following up with a change to keep all io.sentry.* classes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sounds good 👍


# Keep bitmap classes used by JNI
-keep class android.graphics.Bitmap { *; }
-keep class android.graphics.Bitmap$Config { *; }

# To ensure that stack traces is unambiguous
# https://developer.android.com/studio/build/shrink-code#decode-stack-trace
-keepattributes LineNumberTable,SourceFile
2 changes: 1 addition & 1 deletion flutter/lib/src/native/java/android_replay_recorder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
// Android Bitmap creation is a bit costly so we reuse it between captures.
native.Bitmap? bitmap;

final _nativeReplay = native.SentryFlutterPlugin$Companion(null)
final _nativeReplay = native.SentryFlutterPlugin.Companion

Check warning on line 143 in flutter/lib/src/native/java/android_replay_recorder.dart

View check run for this annotation

Codecov / codecov/patch

flutter/lib/src/native/java/android_replay_recorder.dart#L143

Added line #L143 was not covered by tests
.privateSentryGetReplayIntegration()!;

receivePort.listen((message) {
Expand Down
Loading