Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
01efed6
build: Switch to JDK 21 and upgrade Mockito, Robolectric and Error Prone
markushi Oct 9, 2026
8ff189d
build: Compile tests for JDK 21 and fix buildSrc JVM target
markushi Oct 9, 2026
222087c
feat(android): Add ANR warning breadcrumbs on Android 17+
markushi Oct 12, 2026
7f86c34
docs(changelog): Add entry for ANR warning breadcrumbs
markushi Oct 12, 2026
18a3504
fix(android): Keep the no-arg AppLifecycleIntegration constructor as …
markushi Oct 12, 2026
5800936
Merge branch 'main' into markushi/feat/anr-warning-listener [pr-sheph…
markushi Oct 21, 2026
c6c5bc3
[pr-shepherd] Merge origin/main into markushi/feat/anr-warning-listener
sentry-junior[bot] Oct 23, 2026
a9ea1cc
ref(android): Address review comments on ANR warning listener
markushi Nov 9, 2026
acaa97c
Merge origin/main into markushi/feat/anr-warning-listener
markushi Nov 9, 2026
6c235cd
docs(changelog): Move ANR warning entry to Unreleased
markushi Nov 9, 2026
e9b3b4c
Merge origin/main into markushi/feat/anr-warning-listener
markushi Nov 10, 2026
a46e24c
fix(android): Register ANR warning listener outside the lock
markushi Nov 10, 2026
465cce4
Merge origin/main into markushi/feat/anr-warning-listener
markushi Nov 16, 2026
b7713e2
Merge remote-tracking branch 'origin/main' into markushi/feat/anr-war…
markushi Nov 26, 2026
4f3d4fc
docs(changelog): Move ANR warning entry to Unreleased
markushi Nov 26, 2026
153f32c
fix(android): Gate ANR description on user info and release scopes on…
markushi Nov 26, 2026
b8c340d
Merge branch 'main' into markushi/feat/anr-warning-listener
markushi Nov 26, 2026
ed2e0dd
fix(android): Always send the ANR description, the system already red…
markushi Nov 26, 2026
260c9a8
ref(android): Move ANR warnings into AnrWarningListenerIntegration wi…
markushi Nov 26, 2026
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@

- Android: A crash long after `Sentry.init` is no longer marked as a startup crash when the device slept in between, because the time since init now counts deep sleep ([#6738](https://github.com/getsentry/sentry-java/pull/6738))

### Features

- Record ANR warnings from the system as `app.anr` breadcrumbs on Android 17 (API 37) and above ([#6245](https://github.com/getsentry/sentry-java/pull/6245))
- The breadcrumb contains the ANR type, the system description, the timeout, and how much of the timeout was already used.
- It is enabled by default. To disable it, set `options.isEnableAnrWarningBreadcrumbs = false` or add `<meta-data android:name="io.sentry.breadcrumbs.anr-warnings" android:value="false" />` to your `AndroidManifest.xml`.

### Dependencies

- Bump OpenTelemetry ([#6691](https://github.com/getsentry/sentry-java/pull/6691))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
Expand Down Expand Up @@ -110,7 +111,18 @@ class JdkTargetConvention : Plugin<Project> {
}

listOf("com.android.library", "com.android.application").forEach { pluginId ->
project.plugins.withId(pluginId) { project.targetBuildJdkForUnitTests() }
project.plugins.withId(pluginId) {
project.targetBuildJdkForUnitTests()
// Robolectric's SDK 37 sandbox (the default, as targetSdk is 37) reflectively writes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any implications of adding this to all the test tasks/modules? like does it have any build speed impact?

// FileDescriptor fields in ApplicationSharedMemory; without this, setup fails with
// "Failed to interact with raw FileDescriptor internals".
project.tasks.withType(Test::class.java).configureEach {
jvmArgs(
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-exports=java.base/jdk.internal.access=ALL-UNNAMED",
)
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ import org.gradle.work.DisableCachingByDefault
*/
private val ANDROID_ALL_VERSIONS =
mapOf(
21 to "5.0.2_r3-robolectric-r0",
23 to "6.0.1_r3-robolectric-r1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to consolidate these in a separate PR.

24 to "7.0.0_r1-robolectric-r1",
28 to "9-robolectric-4913185-2",
29 to "10-robolectric-5803371",
30 to "11-robolectric-6757853",
31 to "12-robolectric-7732740",
33 to "13-robolectric-9030017",
35 to "15-robolectric-12650502",
35 to "15-robolectric-13954326",
37 to "17-robolectric-15733970",
)

/** The instrumentation revision Robolectric appends to every android-all version. */
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ okhttp-tls = { module = "com.squareup.okhttp3:okhttp-tls", version.ref = "okhttp
okio = { module = "com.squareup.okio:okio", version = "3.18.2" }
rhino = { module = "org.mozilla:rhino", version = "1.8.0" }
# Upgrading Robolectric can change the android-all jars it needs, see SentryRobolectricPlugin.
roboelectric = { module = "org.robolectric:robolectric", version = "4.15" }
roboelectric = { module = "org.robolectric:robolectric", version = "4.17" }

[bundles]
androidx-room2 = ["androidx-room-runtime", "androidx-room-ktx"]
Expand Down
8 changes: 8 additions & 0 deletions sentry-android-core/api/sentry-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ public final class io/sentry/android/core/AnrV2Integration$AnrV2Hint : io/sentry
public fun timestamp ()Ljava/lang/Long;
}

public final class io/sentry/android/core/AnrWarningListenerIntegration : io/sentry/Integration, java/io/Closeable {
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/BuildInfoProvider;)V
public fun close ()V
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
}

public final class io/sentry/android/core/AppComponentsBreadcrumbsIntegration : android/content/ComponentCallbacks2, io/sentry/Integration, java/io/Closeable {
public fun <init> (Landroid/content/Context;)V
public fun close ()V
Expand Down Expand Up @@ -459,6 +465,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr
public fun isEnableActivityLifecycleBreadcrumbs ()Z
public fun isEnableActivityLifecycleTracingAutoFinish ()Z
public fun isEnableAnrFingerprinting ()Z
public fun isEnableAnrWarningBreadcrumbs ()Z
public fun isEnableAppComponentBreadcrumbs ()Z
public fun isEnableAppLifecycleBreadcrumbs ()Z
public fun isEnableAutoActivityLifecycleTracing ()Z
Expand Down Expand Up @@ -494,6 +501,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr
public fun setEnableActivityLifecycleBreadcrumbs (Z)V
public fun setEnableActivityLifecycleTracingAutoFinish (Z)V
public fun setEnableAnrFingerprinting (Z)V
public fun setEnableAnrWarningBreadcrumbs (Z)V
public fun setEnableAppComponentBreadcrumbs (Z)V
public fun setEnableAppLifecycleBreadcrumbs (Z)V
public fun setEnableAutoActivityLifecycleTracing (Z)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ static void installDefaultIntegrations(
options.addIntegration(AnrIntegrationFactory.create(context, buildInfoProvider));

options.addIntegration(new AnrProfilingIntegration());
options.addIntegration(new AnrWarningListenerIntegration(context, buildInfoProvider));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we only add this on API 37+ ?


// registerActivityLifecycleCallbacks is only available if Context is an AppContext
if (context instanceof Application) {
Expand Down
Loading
Loading