Skip to content

sentry-java silently fails to deliver event when conflicting Gson class is on the classpath #1733

@antonmos

Description

@antonmos

Platform:

  • Android -> If yes, which Device API (and compileSdkVersion/targetSdkVersion/Build tools) version?
  • Java -> If yes, which Java (and sourceCompatibility/targetCompatibility) version?
  • Kotlin -> If yes, which Kotlin (and jvmTarget) version?
  • NDK -> If yes, which NDK/CMake version?
  • React-Native -> If yes, which version?
  • Timber -> If yes, which version?
  • Log4j2 -> If yes, which version?
  • Logback -> If yes, which version?
  • Spring -> If yes, which version?

IDE:

  • Android Studio -> If yes, which version?
  • IntelliJ -> If yes, which version?
  • Other -> If yes, which one?

Build system:

  • Gradle -> If yes, which version?
  • Buck -> If yes, which version?
  • Bazel -> If yes, which version?
  • Maven -> If yes, which version?
  • Other -> If yes, which one?

Android Gradle Plugin:

  • Yes -> If yes, which version?
  • No

Sentry Android Gradle Plugin:

  • Yes -> If yes, which version?
  • No

Proguard/R8:

  • Enabled
  • Disabled

Platform installed with:

  • JCenter
  • Bintray
  • Maven Central
  • Manually

The version of the SDK:
5.1.1


I have the following issue:
Another library included a copy of com.google.gson.Gson class which caused sentry-java to silently fail to deliver the event to sentry. When we enabled the logs, we observed the following:

DEBUG: Capturing event: 138d4d2eeb2845acaf8829723001ba8f
INFO: Session is null on scope.withSession
ERROR: Request failed, API returned 400
ERROR: {"detail":"empty envelope"}

Using a debugger, we were able to see that NoSuchMethodError was thrown when calling Gson.excluder() method from UnknownPropertiesTypeAdapterFactory.

Steps to reproduce:

  • See above.

Actual result:

  • The error was not informative and we had to use a debugger to find the root cause

Expected result:

  • informative ERROR should have been logged to the Sentry ILogger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency file
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions