Skip to content

Android build fails after removing protobuf-lite dependency for tombstones #5198

@tustanivsky

Description

@tustanivsky

Integration

sentry-android

Build System

Gradle

AGP Version

7.4.2

Proguard

Enabled

Version

8.35.0

Steps to Reproduce

After the protobuf-javaliteepitaph migration in #5157 (released in 8.35.0), Android builds fail with a D8 NullPointerException when dexing epitaph-0.1.0.jar.

This issue was discovered in Unreal SDK, where the epitaph dependency is pulled via Gradle during Android builds.

Related items:

This behavior likely occurs because Epitaph's enum classes (Architecture, MemoryError.Tool, MemoryError.Type) are compiled without the -parameters javac flag. This causes the compiler to emit MethodParameters attributes with null names for synthetic enum constructor parameters. D8 calls String.length() on these null names, which results in a crash.

Adding the -parameters flag to Epitaph’s build.gradle.kts and rebuilding the library locally confirmed that this resolves the issue.

Side note: upgrading to Android Gradle Plugin 8.x may resolve the issue, but this is not feasible for some older Unreal Engine versions we support due to other compatibility constraints.

Expected Result

Build completes successfully.

Actual Result

Build fails with the following exception:

> Task :app:mergeExtDexDebug
ERROR:/home/gh/.gradle/caches/8.14.2/transforms/d88f69e91bb61f3a6d035f24ed1e8d37/transformed/epitaph-0.1.0.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null
...
> Failed to transform epitaph-0.1.0.jar (com.abovevacant:epitaph:0.1.0)
    > Execution failed for DexingNoClasspathTransform
        > Error while dexing.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions