Skip to content

[Bug]: Proguard opentelemetry error #2675

Description

@jt-gilkeson

What happened?

When we updated Embrace (which also uses OTel), we started getting a build error (that's being caused by OneSignal)

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /bitrise/src/app/build/outputs/mapping/staging/missing_rules.txt.
ERROR: R8: Missing class io.opentelemetry.api.internal.ApiUsageLogger (referenced from: io.opentelemetry.api.incubator.trace.ExtendedDefaultTracer$NoopSpanBuilder io.opentelemetry.api.incubator.trace.ExtendedDefaultTracer$NoopSpanBuilder.setParent(io.opentelemetry.context.Context))

This is the dependency graph:

com.onesignal:otel:5.9.5
├── io.opentelemetry:opentelemetry-bom:1.55.0 -> 1.62.0
├── io.opentelemetry:opentelemetry-api -> 1.62.0 ← ApiUsageLogger is here
├── io.opentelemetry:opentelemetry-sdk -> 1.62.0
├── io.opentelemetry:opentelemetry-exporter-otlp -> 1.62.0
├── io.opentelemetry.semconv:opentelemetry-semconv:1.37.0
└── io.opentelemetry.contrib:opentelemetry-disk-buffering:1.51.0-alpha

Steps to reproduce?

1. Use OneSignal SDK
2. Use another SDK that has a more up to date Otel 
3. Build Fails.

What did you expect to happen?

I expected the build to work regardless of other libraries having a more up to date version of Otel.

It seems like your proguard rules or build might not be configured correctly?

# Activated with the Embrace 9.0.0 bump, which pulls opentelemetry-bom:1.62.0 and
# upgrades OneSignal's transitive OTel API 1.55.0 -> 1.62.0; ApiUsageLogger was
# removed in 1.62.0 while OneSignal's opentelemetry-api-incubator:1.55.0-alpha
# still references it, so R8 fails without this rule.

-dontwarn io.opentelemetry.**

Seems to fix it, but the client shouldn't have to do this stuff, the library should not break due to other libraries being more recent.

Also can you please update Otel to a current version and get rid of reliance on opentelemetry-api-incubator:1.55.0-alpha

OneSignal Android SDK version

5.9.5

Android version

15

Specific Android models

N/A

Relevant log output

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /bitrise/src/app/build/outputs/mapping/staging/missing_rules.txt.
ERROR: R8: Missing class io.opentelemetry.api.internal.ApiUsageLogger (referenced from: io.opentelemetry.api.incubator.trace.ExtendedDefaultTracer$NoopSpanBuilder io.opentelemetry.api.incubator.trace.ExtendedDefaultTracer$NoopSpanBuilder.setParent(io.opentelemetry.context.Context))

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions