Skip to content

Android build fails with cannot find symbol ReplayIntegration when sentry-android-replay is excluded #6802

Description

@InterstellarStella

What React Native libraries do you use?

React Native without Frameworks

Are you using sentry.io or on-premise?

sentry.io (SaS)

Are you using any other error monitoring solution alongside Sentry?

No

Other Error Monitoring Solution Name

No response

@sentry/react-native SDK Version

8.20.0 (bundles io.sentry:sentry-android:8.49.0). Still present on 8.28.0 (8.58.0).

How does your development environment look like?

Not environment specific. This is a compile error in the SDK's Android sources, independent of the React Native version or tooling.

Sentry.init()

// Not relevant, the failure happens at compile time.
// Session Replay is not configured.
Sentry.init({
  dsn: 'https://...@sentry.io/...',
});

Steps to Reproduce

  1. Install @sentry/react-native@8.20.0 in a React Native app.
  2. Exclude the replay module as documented in Excluding Session Replay from Android and fix(replay): Allow excluding the sentry-android-replay module from android targets #5174, in the root android/build.gradle:
    subprojects {
      configurations.all {
        exclude group: 'io.sentry', module: 'sentry-android-replay'
      }
    }
  3. Build Android, for example cd android && ./gradlew assembleDebug.

Expected Result

The @sentry/react-native Android library compiles without sentry-android-replay on the classpath, as it did after #5174 (released in 7.1.0).

Actual Result

compileDebugJavaWithJavac fails for the @sentry/react-native module:

error: cannot find symbol
  symbol:   class ReplayIntegration
  location: package io.sentry.android.replay
/node_modules/@sentry/react-native/android/src/main/java/io/sentry/react/replay/RNSentryReplayFragmentLifecycleTracer.java:23: error: cannot find symbol
  private @Nullable ReplayIntegration replayIntegration;

Root cause:

Workaround: delete RNSentryReplayFragmentLifecycleTracer.java from node_modules/@sentry/react-native/android/src/main/java/io/sentry/react/replay/ using patch-package or yarn patch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions