Skip to content

feat(android): Warn when Gradle resolves unsupported sentry-android version - #6238

Merged
antonis merged 3 commits into
mainfrom
antonislilis/rn-111-add-warning-when-gradle-resolves-to-unsupported-sentry
Jun 3, 2026
Merged

antonis merged 3 commits into
mainfrom
antonislilis/rn-111-add-warning-when-gradle-resolves-to-unsupported-sentry

Conversation

@antonis

@antonis antonis commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds a build-time warning when the resolved sentry-android-core version differs from what @sentry/react-native expects. The check runs in sentry.gradle.kts, which is applied in the app project's context and therefore sees the app's final resolved dependency graph.

Example warning output:

WARNING: @sentry/react-native depends on sentry-android 8.43.0, but version 8.42.0 was resolved.
This may cause build errors or unexpected behavior.
The most common cause is the Sentry Android Gradle Plugin (SAGP) overriding the version via
autoInstallation. To fix this, set autoInstallation.enabled = false in your app/build.gradle.
Other causes include resolutionStrategy.force, BOMs, or another library depending on a different
sentry-android version.

Also extracts the sentry-android version to a variable in build.gradle and updates the bump script (update-android.sh) to maintain the version in both build.gradle and sentry.gradle.kts.

💡 Motivation and Context

When @sentry/react-native is combined with SAGP (or other dependency management), Gradle may resolve sentry-android to 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):

  1. Mismatch detected: Added resolutionStrategy.force 'io.sentry:sentry-android-core:8.42.0' to samples/react-native/android/app/build.gradle → warning appeared in build output.
  2. No false positive: Removed the force → no warning emitted.
  3. Bump script round-trip: update-android.sh set-version updates both build.gradle and sentry.gradle.kts correctly.
  4. yarn build passes.

📝 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
  • No breaking changes

🔮 Next steps

Loading
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