Skip to content

Update Sentry Android (sentry-java) bindings to fix NullPointerException in AndroidEnvelopeCache.lastReportedAnr #5004

@andrew-kulikov

Description

@andrew-kulikov

Problem Statement

Description

When using sentry-dotnet 6.1.0 on Android (with sentry-java 8.29.0), a non-fatal NullPointerException occurs during Sentry initialization when reading the last ANR marker file. Sentry still initializes and ANR monitoring works, but the error appears in logs and can be confusing.

Environment

  • Sentry .NET version: 6.1.0
  • Sentry Android SDK (sentry-java): 8.29.0
  • Target framework: .NET 10 (net10.0-android)
  • Platform: Android

Error:

SentryLogger | Error | Android: Error reading last ANR marker --> Java.Lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

Stack trace:

at io.sentry.android.core.cache.AndroidEnvelopeCache.lastReportedAnr(AndroidEnvelopeCache.java:165)
at io.sentry.android.core.AnrV2Integration$AnrProcessor.run(AnrV2Integration.java:...)

Root cause

In sentry-java 8.28.0 and 8.29.0, AndroidEnvelopeCache.lastReportedAnr does not handle a null return from FileUtils.readText(). The fix was added in getsentry/sentry-java#4979.

Request

Please update the Sentry Android bindings in sentry-dotnet to use a sentry-java version that includes this fix.

Solution Brainstorm

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeFeatureNew feature or request
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions