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
languageVersionis upgraded to1.4.Gsonis removed as a transitive dependency and vendored in the SDK.- Protocol classes now implement the
JsonSerializableandJsonDeserializerinterfaces.
- Protocol classes now implement the
SentryOptions#shutdownTimeoutis renamed toshutdownTimeoutMillis.Removed
@Deprecatedand@ApiStatus.ScheduledForRemovalmethodsITransaction#setRequestITransaction#getRequestITransaction#getContextsSentryBaseEvent#getOriginThrowableSentryOptions#getCacheDirSizeSentryOptions#setCacheDirSizeSentryOptions#isEnableSessionTrackingSentryOptions#setEnableSessionTracking
Removed unnecessary abstractions
IBuildInfoProvideris nowBuildInfoProvideronly.IHandleris nowMainLooperHandleronly.
ISpannow has higher precision using theSystem#nanoTimeinstead of milliseconds.Hints changed its type from
Objecttoio.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#enableScopeSyncis now enabled by default, to disable it, see the code snippet below.
AndroidManifest.xmlCopied
<meta-data
android:name="io.sentry.ndk.scope-sync.enable"
android:value="false"
/>
SentryOptions#sendClientReportsis now enabled by default. To disable it, use the code snippet below:
AndroidManifest.xmlCopied
<meta-data
android:name="io.sentry.send-client-reports"
android:value="false"
/>
- Starting with version
6.0.0ofsentry, Sentry's version >= v21.9.0 is required or you have to manually disable sending client reports via thesendClientReportsoption. 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").
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").