Repository navigation
build(ndk): strip unnamed MethodParameters for older R8 - #2266
Merged
Merged
Conversation
bitsandfoxes
marked this pull request as ready for review
October 28, 2026 14:27
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2266 +/- ##
==========================================
- Coverage 75.71% 75.67% -0.04%
==========================================
Files 103 103
Lines 28316 28316
Branches 5208 5208
==========================================
- Hits 21439 21428 -11
- Misses 5529 5549 +20
+ Partials 1348 1339 -9 🚀 New features to boost your workflow:
|
romtsn
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Strip
MethodParametersentries without a name from thendkmodule's classes afterJavaCompile, the same way sentry-java does in getsentry/sentry-java#6356.Since JDK 21, javac writes
MethodParametersentries without a name for mandated and synthetic parameters (JDK-8292275), even with--release 8/-source 8 -target 8. Here that's the enumio.sentry.ndk.NdkHandlerStrategy(valueOfand its constructor). D8/R8 older than 8.1 (AGP 8.0 and older) crash on those entries while minifying:The new
StripMethodParametersaction inndk/lib/build.gradle.ktsdrops the attribute only from methods that have an unnamed entry, using the ASM that AGP already brings. Classes without such entries aren't rewritten.-parameterswould also work, but sentry-java opted out of it because of the added size and possible binary incompatibilities, so this mirrors their fix instead.Our CI and releases build with JDK 17, so the published
sentry-native-ndkdoesn't have the problem today, and the action is a no-op there. It shows up when the module is built from source with JDK 21+: sentry-unity does that since sentry-java 8.61.1 requires JDK 21 (getsentry/sentry-java#6242), and Unity 2021.3 ships AGP 7.4.2 (R8 4.0.48), so its Android player builds fail.Verified:
./gradlew :sentry-native-ndk:assembleRelease :sentry-native-ndk:testDebugUnitTest spotlessCheckpasses. The AAR's classes go from 4 unnamed entries to 0. Compared withjavap -v -p -cagainst an unpatched build, the only difference is the twoMethodParametersblocks ofNdkHandlerStrategy.#skip-changelog: no change to the published artifact, which is built with JDK 17.
🤖 Generated with Claude Code