Skip to content

fix: [SDK-4820] ship consumer dontwarn rule for OpenTelemetry to prevent R8 missing-class build failures#2677

Open
abdulraqeeb33 wants to merge 3 commits into
mainfrom
ar/sdk-4820
Open

fix: [SDK-4820] ship consumer dontwarn rule for OpenTelemetry to prevent R8 missing-class build failures#2677
abdulraqeeb33 wants to merge 3 commits into
mainfrom
ar/sdk-4820

Conversation

@abdulraqeeb33

@abdulraqeeb33 abdulraqeeb33 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Root cause: When a third-party SDK in the host app bumps opentelemetry-bom (e.g. Embrace -> 1.62.0), it upgrades OneSignal's transitive OpenTelemetry artifacts to a version where io.opentelemetry.api.internal.ApiUsageLogger has been removed. The transitively-pulled opentelemetry-api-incubator alpha (via ExtendedDefaultTracer) still references that class, so the cross-version skew surfaces as fatal R8 Missing class io.opentelemetry.api.internal.ApiUsageLogger errors in consuming apps even though the code path is never executed.
  • Fix: Ship -dontwarn rules in the otel module's consumer-rules.pro. R8 suppresses a "Missing class" diagnostic when the missing class itself matches a -dontwarn, so we match the internal packages directly with -dontwarn io.opentelemetry.**.internal.** — this is referrer-independent and robustly covers ApiUsageLogger regardless of which artifact references it. We keep -dontwarn io.opentelemetry.api.incubator.** alongside it so R8 still surfaces warnings for OneSignal's own actively-used OTel classes (api.logs, sdk, exporter) if a bump ever breaks them. Because consumer rules ship inside the published AAR, this applies to every consuming app automatically — clients don't have to add their own keep/dontwarn rules to build.
  • Risk: Low. This only suppresses R8 missing-class warnings for internal/incubator classes that aren't on the executed code path; it doesn't change runtime behavior.

The shipped rules are:

-dontwarn io.opentelemetry.api.incubator.**
-dontwarn io.opentelemetry.**.internal.**

This is the low-risk Option A. A longer-term Option B — aligning OneSignal's OpenTelemetry dependency versions (so the incubator alpha and core artifacts can't drift across versions) — is recommended as a follow-up.

Test plan

  • Verify the -dontwarn io.opentelemetry.api.incubator.** and -dontwarn io.opentelemetry.**.internal.** rules ship in the published otel AAR's consumer ProGuard rules.
  • Build a minified / R8-enabled app that also pulls a newer opentelemetry-bom (e.g. via Embrace) and confirm there is no Missing class io.opentelemetry.api.internal.ApiUsageLogger error.

Made with Cursor

…ent R8 missing-class build failures

A third-party SDK in the host app (e.g. Embrace bumping opentelemetry-bom to
1.62.0) upgrades OneSignal's transitive OpenTelemetry artifacts to a version
where io.opentelemetry.api.internal.ApiUsageLogger no longer exists. The
transitively-pulled opentelemetry-api-incubator alpha (via ExtendedDefaultTracer)
still references that class, so the cross-version skew surfaces as fatal R8
"Missing class" errors in consuming apps even though the code path never runs.

Shipping the -dontwarn io.opentelemetry.** rule in the otel module's
consumer-rules.pro bundles it into the published AAR, so clients don't have to
add their own keep/dontwarn rules to build.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

✓ Coverage check passed (no source files changed)

📥 View workflow run

abdulraqeeb33 and others added 2 commits July 2, 2026 20:06
Scope the consumer -dontwarn from io.opentelemetry.** to io.opentelemetry.api.incubator.**
so R8 still surfaces missing-class warnings for OneSignal's own actively-used OTel
classes (api.logs, sdk, exporter) while still suppressing the dangling ApiUsageLogger
reference from the unused opentelemetry-api-incubator alpha artifact.
…warn so R8 skew errors are suppressed referrer-independently

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant