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
Open
fix: [SDK-4820] ship consumer dontwarn rule for OpenTelemetry to prevent R8 missing-class build failures#2677abdulraqeeb33 wants to merge 3 commits into
abdulraqeeb33 wants to merge 3 commits into
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>
Contributor
📊 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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