feat(android): Warn when Gradle resolves unsupported sentry-android version#6238
Open
antonis wants to merge 3 commits into
Open
feat(android): Warn when Gradle resolves unsupported sentry-android version#6238antonis wants to merge 3 commits into
antonis wants to merge 3 commits into
Conversation
…ersion When the Sentry Android Gradle Plugin (SAGP) or other dependency management overrides sentry-android to a version different from what @sentry/react-native expects, users hit cryptic build or runtime errors. This adds a build-time warning in sentry.gradle.kts (which runs in the app project context) that detects the mismatch and provides actionable guidance. Also extracts the sentry-android version to a variable in build.gradle and updates the bump script to maintain the version in both files. Closes RN-111 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Contributor
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| b9bebee+dirty | 438.86 ms | 452.21 ms | 13.35 ms |
| 5fe1c6c+dirty | 401.62 ms | 445.28 ms | 43.66 ms |
| f3215d3+dirty | 411.11 ms | 454.38 ms | 43.27 ms |
| 7d6fd3a+dirty | 403.02 ms | 422.56 ms | 19.54 ms |
| 8929511+dirty | 405.33 ms | 452.16 ms | 46.83 ms |
| eb93136+dirty | 416.18 ms | 467.32 ms | 51.14 ms |
| 267d3ed+dirty | 413.06 ms | 440.96 ms | 27.90 ms |
| 4966363+dirty | 400.04 ms | 431.08 ms | 31.04 ms |
| bc0d8cf+dirty | 412.37 ms | 466.26 ms | 53.89 ms |
| c151573+dirty | 530.34 ms | 559.43 ms | 29.09 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| b9bebee+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 5fe1c6c+dirty | 43.75 MiB | 48.14 MiB | 4.39 MiB |
| f3215d3+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| 7d6fd3a+dirty | 43.75 MiB | 48.14 MiB | 4.39 MiB |
| 8929511+dirty | 43.75 MiB | 48.16 MiB | 4.41 MiB |
| eb93136+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 267d3ed+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 4966363+dirty | 48.30 MiB | 53.54 MiB | 5.24 MiB |
| bc0d8cf+dirty | 48.30 MiB | 53.48 MiB | 5.18 MiB |
| c151573+dirty | 48.30 MiB | 53.54 MiB | 5.24 MiB |
Contributor
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| b9bebee+dirty | 500.50 ms | 536.42 ms | 35.92 ms |
| 7ac3378+dirty | 410.67 ms | 442.60 ms | 31.92 ms |
| 8929511+dirty | 469.49 ms | 502.65 ms | 33.16 ms |
| 04207c4+dirty | 395.40 ms | 456.55 ms | 61.15 ms |
| f3215d3+dirty | 396.53 ms | 436.66 ms | 40.13 ms |
| 5c1e987+dirty | 444.71 ms | 475.13 ms | 30.42 ms |
| eb93136+dirty | 500.37 ms | 532.58 ms | 32.21 ms |
| 267d3ed+dirty | 424.69 ms | 483.70 ms | 59.01 ms |
| 4966363+dirty | 415.67 ms | 448.60 ms | 32.93 ms |
| 5fe1c6c+dirty | 365.84 ms | 408.62 ms | 42.78 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| b9bebee+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 7ac3378+dirty | 43.94 MiB | 48.99 MiB | 5.05 MiB |
| 8929511+dirty | 43.94 MiB | 49.02 MiB | 5.08 MiB |
| 04207c4+dirty | 43.94 MiB | 48.98 MiB | 5.04 MiB |
| f3215d3+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| 5c1e987+dirty | 43.94 MiB | 48.94 MiB | 5.00 MiB |
| eb93136+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 267d3ed+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 4966363+dirty | 48.30 MiB | 53.54 MiB | 5.24 MiB |
| 5fe1c6c+dirty | 43.94 MiB | 49.00 MiB | 5.06 MiB |
- Update check-android-sdk-mismatch.js regex to parse sentryAndroidVersion variable instead of inline dependency string - Add validation in update-android.sh that sentry.gradle.kts contains expectedSentryAndroidVersion before attempting sed replacement Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f48643f. Configure here.
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.

📢 Type of change
📜 Description
Adds a build-time warning when the resolved
sentry-android-coreversion differs from what@sentry/react-nativeexpects. The check runs insentry.gradle.kts, which is applied in the app project's context and therefore sees the app's final resolved dependency graph.Example warning output:
Also extracts the
sentry-androidversion to a variable inbuild.gradleand updates the bump script (update-android.sh) to maintain the version in bothbuild.gradleandsentry.gradle.kts.💡 Motivation and Context
When
@sentry/react-nativeis combined with SAGP (or other dependency management), Gradle may resolvesentry-androidto a version different from what the RN SDK was built against. This causes cryptic build errors or runtime crashes that are hard to diagnose:Closes RN-111
💚 How did you test it?
Tested locally against the sample app (Gradle 9.3.1 / JDK 17):
resolutionStrategy.force 'io.sentry:sentry-android-core:8.42.0'tosamples/react-native/android/app/build.gradle→ warning appeared in build output.update-android.sh set-versionupdates bothbuild.gradleandsentry.gradle.ktscorrectly.yarn buildpasses.📝 Checklist
sendDefaultPIIis enabled🔮 Next steps