Skip to content

Commit bae1d71

Browse files
antonisclaude
andcommitted
docs(react-native): Add warning about AGP autoInstallation on Android
Add alerts to manual setup and v7-to-v8 migration guides warning that the Sentry Android Gradle Plugin autoInstallation must be disabled for React Native. Add a troubleshooting section for the IllegalStateException mix of versions crash caused by this misconfiguration. Refs getsentry/sentry-react-native#5682 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 47f56ce commit bae1d71

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

docs/platforms/react-native/manual-setup/manual-setup.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ buildscript {
185185

186186
You can configure the plugin options in `android/app/build.gradle`, as shown below:
187187

188+
<Alert level="warning" title="Auto-Installation Must Be Disabled">
189+
190+
The `autoInstallation` option **must** be set to `false` when using the Sentry Android Gradle Plugin with React Native. The `@sentry/react-native` SDK manages its own `sentry-android` dependency. If auto-installation is enabled, the plugin may pull in a different `sentry-android` version, causing an `IllegalStateException: Sentry SDK has detected a mix of versions` crash at app startup.
191+
192+
</Alert>
193+
188194
```groovy {filename:android/app/build.gradle}
189195
apply plugin: "io.sentry.android.gradle"
190196
@@ -207,6 +213,7 @@ sentry {
207213
// which might be incompatible with the React Native SDK
208214
// Enable auto-installation of Sentry components (sentry-android SDK and okhttp, timber and fragment integrations).
209215
// Default is enabled.
216+
// IMPORTANT: Must be false for React Native.
210217
autoInstallation {
211218
enabled = false
212219
}

docs/platforms/react-native/migration/v7-to-v8.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ buildscript {
6161
}
6262
```
6363

64+
<Alert level="warning" title="Sentry Android Gradle Plugin Auto-Installation">
65+
66+
If you use the Sentry Android Gradle Plugin (AGP), make sure `autoInstallation` is **disabled** in your `android/app/build.gradle`. The `@sentry/react-native` SDK ships with its own compatible `sentry-android` dependency. If `autoInstallation` is enabled, the plugin may pull in a different `sentry-android` version, causing an `IllegalStateException: Sentry SDK has detected a mix of versions` crash at app startup. See the [manual setup guide](/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp) for the correct configuration.
67+
68+
</Alert>
69+
6470
#### Sentry Self-Hosted
6571

6672
Sentry CLI v3 requires self-hosted Sentry instances version **25.11.1+** (previously 25.2.0).

docs/platforms/react-native/troubleshooting/index.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,32 @@ You can also use [Advanced Data Scrubbing](/security-legal-pii/scrubbing/advance
359359
[Replace] [Anything] from [contexts.trace.data.previousRoute.params]
360360
```
361361
362+
## Android: IllegalStateException Mix of Versions
363+
364+
If your Android app crashes on startup with:
365+
366+
```
367+
IllegalStateException: Sentry SDK has detected a mix of versions
368+
```
369+
370+
This is caused by the Sentry Android Gradle Plugin (AGP) auto-installing a `sentry-android` version that conflicts with the one shipped by `@sentry/react-native`.
371+
372+
### Solution
373+
374+
Set `autoInstallation.enabled = false` in your `android/app/build.gradle`:
375+
376+
```groovy {filename:android/app/build.gradle}
377+
sentry {
378+
autoInstallation {
379+
enabled = false
380+
}
381+
}
382+
```
383+
384+
The React Native SDK manages its own compatible `sentry-android` dependency, so the Gradle plugin should not auto-install one. See the [manual setup guide](/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp) for the full configuration.
385+
386+
For more information, see [GitHub issue #5682](https://github.com/getsentry/sentry-react-native/issues/5682).
387+
362388
## Sentry Android Gradle Plugin Circular Dependency
363389
364390
If you encounter a circular dependency error when building your Android app with the Sentry Android Gradle Plugin, this is typically caused by using an older version of the Android Gradle Plugin (AGP).

0 commit comments

Comments
 (0)