Skip to content

fix(android): Correct New Architecture native-build gate to RN 0.76+#6407

Merged
antonis merged 2 commits into
mainfrom
fix/rn-076-prefab-gate
Jul 6, 2026
Merged

fix(android): Correct New Architecture native-build gate to RN 0.76+#6407
antonis merged 2 commits into
mainfrom
fix/rn-076-prefab-gate

Conversation

@antonis

@antonis antonis commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

The libsentry-tm-perf-logger.so native build (added in 8.17.0, #6307) is gated on the host app's React Native version because it links the ReactAndroid::reactnative prefab. That gate was off by one:

// before
return major > 0 || minor >= 75
// after
return major > 0 || minor >= 76

The merged libreactnative.so — exposed as the ReactAndroid::reactnative prefab selector — was introduced in React Native 0.76. On RN 0.75 and earlier, the native code is split across separate prefab modules (react_nativemodule_core, etc.) and ReactAndroid::reactnative does not exist. With the old minor >= 75 gate, an app on RN 0.75.x with newArchEnabled=true would run our CMake build, which calls find_package(ReactAndroid REQUIRED CONFIG) + target_link_libraries(... ReactAndroid::reactnative) against a target that isn't there — failing at the CMake configure step, before any linking.

💡 Motivation and Context

Found while investigating the class of build failures around this app-compiled library (#6394, #6398). Unlike the armeabi-v7a link failure (#6406), this one fails at configure time, so a linker flag can't rescue it — the gate itself must be correct.

Verified the version boundary directly:

  • RN 0.72 AAR: no unified reactnative prefab (split modules only)
  • RN 0.85.1 / 0.86.0 AARs: reactnative prefab present, TurboModulePerfLogger::enableLogging exported
  • RN docs confirm the merged libreactnative.so shipped in 0.76 (release notes, RFC #816)

With the fix, RN 0.75.x New Arch builds simply skip the native target (TurboModule perf tracking degrades to a no-op when the library is absent), instead of breaking the build.

💚 How did you test it?

Confirmed the prefab-availability boundary against cached RN AARs (0.72 vs 0.85/0.86) and RN's own release documentation. The change is a one-line version-gate correction with updated explanatory comments; RN 0.76+ New Arch behaviour is unchanged (still builds the native target).

📝 Checklist

  • 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.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

antonis and others added 2 commits July 6, 2026 10:35
The `libsentry-tm-perf-logger.so` native build is gated on the host RN
version because it links the `ReactAndroid::reactnative` prefab. That
merged prefab target only exists from RN 0.76 onward (RN 0.76 introduced
the unified libreactnative.so; 0.75 and earlier split the native code
across separate prefab modules). The gate used `minor >= 75`, so on RN
0.75.x with New Architecture enabled CMake would try to link a
non-existent target and fail at the configure step.

Change the gate to `minor >= 76` so RN 0.75.x New Arch builds skip the
native target instead of breaking. TurboModule perf tracking already
degrades to a no-op when the library is absent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(android): Correct New Architecture native-build gate to RN 0.76+ by antonis in #6407

🤖 This preview updates automatically when you update the PR.

@antonis

antonis commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@sentry review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 56939c2. Configure here.

@sentry

sentry Bot commented Jul 6, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.17.1 (96) Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 412.58 ms 441.32 ms 28.74 ms
Size 49.74 MiB 55.09 MiB 5.34 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
f170ec3+dirty 505.96 ms 551.88 ms 45.92 ms
b04af96+dirty 430.33 ms 485.98 ms 55.65 ms
7887847+dirty 420.47 ms 460.55 ms 40.08 ms
eb93136+dirty 500.37 ms 532.58 ms 32.21 ms
c2e182c+dirty 468.50 ms 545.44 ms 76.94 ms
d0e3b3e+dirty 443.19 ms 480.00 ms 36.81 ms
0a147b2+dirty 442.80 ms 522.24 ms 79.44 ms
d038a14+dirty 405.08 ms 444.36 ms 39.28 ms
890d145+dirty 486.42 ms 514.85 ms 28.43 ms
15d4514+dirty 413.63 ms 449.62 ms 35.99 ms

App size

Revision Plain With Sentry Diff
f170ec3+dirty 48.30 MiB 53.57 MiB 5.26 MiB
b04af96+dirty 49.74 MiB 55.00 MiB 5.26 MiB
7887847+dirty 49.74 MiB 54.81 MiB 5.07 MiB
eb93136+dirty 48.30 MiB 53.58 MiB 5.28 MiB
c2e182c+dirty 49.74 MiB 54.85 MiB 5.11 MiB
d0e3b3e+dirty 49.74 MiB 55.09 MiB 5.34 MiB
0a147b2+dirty 49.74 MiB 55.08 MiB 5.34 MiB
d038a14+dirty 48.30 MiB 53.49 MiB 5.19 MiB
890d145+dirty 43.94 MiB 49.00 MiB 5.06 MiB
15d4514+dirty 48.30 MiB 53.60 MiB 5.30 MiB

@antonis antonis marked this pull request as ready for review July 6, 2026 09:19

@alwx alwx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good.
But I think one-line PRs could really be done without Claude and 10 lines of comments that come with Claude :)

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 423.38 ms 480.87 ms 57.50 ms
Size 49.74 MiB 55.09 MiB 5.34 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0d9949d+dirty 403.57 ms 437.00 ms 33.43 ms
64630e5+dirty 419.18 ms 464.58 ms 45.40 ms
853723c+dirty 405.54 ms 440.08 ms 34.54 ms
1122a96+dirty 422.22 ms 464.33 ms 42.10 ms
5748023+dirty 446.69 ms 505.63 ms 58.94 ms
eb93136+dirty 416.18 ms 467.32 ms 51.14 ms
4e0ba9c+dirty 452.84 ms 473.36 ms 20.52 ms
c2e182c+dirty 471.64 ms 553.59 ms 81.95 ms
a0d8cf8+dirty 411.71 ms 467.57 ms 55.87 ms
d0e3b3e+dirty 421.53 ms 498.19 ms 76.66 ms

App size

Revision Plain With Sentry Diff
0d9949d+dirty 43.75 MiB 48.13 MiB 4.37 MiB
64630e5+dirty 49.74 MiB 54.82 MiB 5.07 MiB
853723c+dirty 48.30 MiB 53.58 MiB 5.28 MiB
1122a96+dirty 48.30 MiB 53.54 MiB 5.24 MiB
5748023+dirty 48.30 MiB 53.54 MiB 5.23 MiB
eb93136+dirty 48.30 MiB 53.58 MiB 5.28 MiB
4e0ba9c+dirty 48.30 MiB 53.49 MiB 5.19 MiB
c2e182c+dirty 49.74 MiB 54.85 MiB 5.11 MiB
a0d8cf8+dirty 48.30 MiB 53.49 MiB 5.19 MiB
d0e3b3e+dirty 49.74 MiB 55.09 MiB 5.34 MiB

@antonis antonis merged commit d7d54c6 into main Jul 6, 2026
114 of 120 checks passed
@antonis antonis deleted the fix/rn-076-prefab-gate branch July 6, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants