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

fix(jni): update proguard rules #3036

merged 5 commits into from
Jul 3, 2025

Conversation

buenaflor
Copy link
Contributor

@buenaflor buenaflor commented Jul 2, 2025

📜 Description

💡 Motivation and Context

Running the app in release means the native java symbols names are obfuscated so we need to add additional rules for keeping them in their original names for JNI to work properly

Closes #3030

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

Copy link

codecov bot commented Jul 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.79%. Comparing base (6ba4675) to head (de58d7d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...r/lib/src/native/java/android_replay_recorder.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3036      +/-   ##
==========================================
+ Coverage   87.97%   89.79%   +1.81%     
==========================================
  Files         287       96     -191     
  Lines        9533     3331    -6202     
==========================================
- Hits         8387     2991    -5396     
+ Misses       1146      340     -806     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

github-actions bot commented Jul 2, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • flutter/lib/src/native/java/android_replay_recorder.dart

@buenaflor buenaflor marked this pull request as ready for review July 3, 2025 09:41
Copy link
Contributor

github-actions bot commented Jul 3, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 455.87 ms 519.36 ms 63.49 ms
Size 6.54 MiB 7.55 MiB 1.01 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
827bf09 475.40 ms 547.14 ms 71.74 ms
c8596a6 474.00 ms 492.96 ms 18.96 ms

App size

Revision Plain With Sentry Diff
827bf09 6.54 MiB 7.53 MiB 1015.27 KiB
c8596a6 6.54 MiB 7.53 MiB 1015.27 KiB

Previous results on branch: fix/jni-proguard-rules

Startup times

Revision Plain With Sentry Diff
1936c70 452.44 ms 508.08 ms 55.64 ms

App size

Revision Plain With Sentry Diff
1936c70 6.54 MiB 7.55 MiB 1.01 MiB

Copy link
Contributor

github-actions bot commented Jul 3, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1258.94 ms 1271.08 ms 12.14 ms
Size 7.86 MiB 9.44 MiB 1.58 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
827bf09 1261.86 ms 1276.41 ms 14.55 ms
c8596a6 1234.11 ms 1241.19 ms 7.08 ms

App size

Revision Plain With Sentry Diff
827bf09 7.86 MiB 9.44 MiB 1.58 MiB
c8596a6 7.86 MiB 9.44 MiB 1.58 MiB

Previous results on branch: fix/jni-proguard-rules

Startup times

Revision Plain With Sentry Diff
1936c70 1257.22 ms 1269.42 ms 12.20 ms

App size

Revision Plain With Sentry Diff
1936c70 7.86 MiB 9.44 MiB 1.58 MiB

Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

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

Is there any way we can verify that this does the correct thing? Integration test with Android release build on CI maybe?

@buenaflor
Copy link
Contributor Author

@denrase I tested it locally and the user confirmed it works in the issue

@buenaflor
Copy link
Contributor Author

we can in the future set up better integration tests with maestro

@buenaflor buenaflor merged commit 2d34233 into main Jul 3, 2025
86 of 90 checks passed
@buenaflor buenaflor deleted the fix/jni-proguard-rules branch July 3, 2025 17:50
@buenaflor buenaflor restored the fix/jni-proguard-rules branch July 3, 2025 17:50
Comment on lines 1 to +4
-keep class io.sentry.flutter.** { *; }

# Keep replay integration classes used by JNI
-keep class io.sentry.android.replay.** { *; }
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 👍

@vaind vaind deleted the fix/jni-proguard-rules branch July 3, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception in Java code called through JNI: java.lang.NoSuchMethodError
3 participants