Migrate from sentry-android 5.x to 6.0.0

Learn about migrating from Sentry Android SDK 5.x to 6.0.0.

  • Kotlin plugin is upgraded to 1.5.

  • Kotlin languageVersion is upgraded to 1.4.

  • Gson is removed as a transitive dependency and vendored in the SDK.

    • Protocol classes now implement the JsonSerializable and JsonDeserializer interfaces.
  • SentryOptions#shutdownTimeout is renamed to shutdownTimeoutMillis.

  • Removed @Deprecated and @ApiStatus.ScheduledForRemoval methods

    • ITransaction#setRequest
    • ITransaction#getRequest
    • ITransaction#getContexts
    • SentryBaseEvent#getOriginThrowable
    • SentryOptions#getCacheDirSize
    • SentryOptions#setCacheDirSize
    • SentryOptions#isEnableSessionTracking
    • SentryOptions#setEnableSessionTracking
  • Removed unnecessary abstractions

    • IBuildInfoProvider is now BuildInfoProvider only.
    • IHandler is now MainLooperHandler only.
  • ISpan now has higher precision using the System#nanoTime instead of milliseconds.

  • Hints changed its type from Object to io.sentry.Hint

Old:

Copied
Sentry.captureException(RuntimeException("exception"), "myStringHint")

New:

Copied
val hints = mutableMapOf<String, Any>("myHint" to "myStringHint")
Sentry.captureException(RuntimeException("exception"), hints)
  • SentryOptions#enableScopeSync is now enabled by default, to disable it, see the code snippet below.
AndroidManifest.xml
Copied
<meta-data
  android:name="io.sentry.ndk.scope-sync.enable"
  android:value="false"
/>
  • SentryOptions#sendClientReports is now enabled by default. To disable it, use the code snippet below:
AndroidManifest.xml
Copied
<meta-data
  android:name="io.sentry.send-client-reports"
  android:value="false"
/>

  • Starting with version 6.0.0 of sentry, Sentry's version >= v21.9.0 is required or you have to manually disable sending client reports via the sendClientReports option. This only applies to self-hosted Sentry. If you are using sentry.io, no action is needed.

There are more changes and refactors, but they are not user breaking changes.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").