fix: [SDK-4820] ship consumer dontwarn rule for OpenTelemetry to prevent R8 missing-class build failures#2677
Conversation
…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>
📊 Diff Coverage Report✓ Coverage check passed (no source files changed) |
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>
|
Could we narrow |
Address review feedback: the io.opentelemetry.**.internal.** wildcard would also suppress genuine missing-class errors in the OTel sdk/exporter internals that OneSignal actively uses. Narrow to io.opentelemetry.api.internal.** so it still covers the dangling ApiUsageLogger reference (referrer-independent) without masking real breakage elsewhere. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Good call @fadi-george — narrowed in 94d100b. Scoped the rule from |
fadi-george
left a comment
There was a problem hiding this comment.
nit: just update pr description
Summary
opentelemetry-bom(e.g. Embrace ->1.62.0), it upgrades OneSignal's transitive OpenTelemetry artifacts to a version whereio.opentelemetry.api.internal.ApiUsageLoggerhas been removed. The transitively-pulledopentelemetry-api-incubatoralpha (viaExtendedDefaultTracer) still references that class, so the cross-version skew surfaces as fatal R8Missing class io.opentelemetry.api.internal.ApiUsageLoggererrors in consuming apps even though the code path is never executed.-dontwarnrules in theotelmodule'sconsumer-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 coversApiUsageLoggerregardless 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.The shipped rules are:
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
-dontwarn io.opentelemetry.api.incubator.**and-dontwarn io.opentelemetry.**.internal.**rules ship in the publishedotelAAR's consumer ProGuard rules.opentelemetry-bom(e.g. via Embrace) and confirm there is noMissing class io.opentelemetry.api.internal.ApiUsageLoggererror.Made with Cursor