Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixes

- Fixed AbstractMethodError when getting Lifecycle ([#2228](https://github.com/getsentry/sentry-java/pull/2228))
- Avoid sending empty profiles ([#2232](https://github.com/getsentry/sentry-java/pull/2232))

## 6.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,29 @@ private void addObserver(final @NotNull IHub hub) {
if (this.options == null) {
return;
}

watcher =
new LifecycleWatcher(
hub,
this.options.getSessionTrackingIntervalMillis(),
this.options.isEnableAutoSessionTracking(),
this.options.isEnableAppLifecycleBreadcrumbs());
ProcessLifecycleOwner.get().getLifecycle().addObserver(watcher);
options.getLogger().log(SentryLevel.DEBUG, "AppLifecycleIntegration installed.");

try {
ProcessLifecycleOwner.get().getLifecycle().addObserver(watcher);
options.getLogger().log(SentryLevel.DEBUG, "AppLifecycleIntegration installed.");
} catch (Throwable e) {
// This is to handle a potential 'AbstractMethodError' gracefully. The error is triggered in
// connection with conflicting dependencies of the androidx.lifecycle.
// //See the issue here: https://github.com/getsentry/sentry-java/pull/2228
watcher = null;
options
.getLogger()
.log(
SentryLevel.ERROR,
"AppLifecycleIntegration failed to get Lifecycle and could not be installed.",
e);
}
}

private void removeObserver() {
Expand Down