Skip to content

feat(android): upgrade to OTel Android 0.13 and OTel Java 1.52 - #799

Draft
abelonogov-ld wants to merge 10 commits into
mainfrom
feat/otel-1.7-upgrade
Draft

abelonogov-ld wants to merge 10 commits into
mainfrom
feat/otel-1.7-upgrade

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #791.

Summary

Upgrades OpenTelemetry Android from 0.11.0-alpha to 0.13.0-alpha, and OpenTelemetry Java from 1.51 to 1.52, in observability-android and in the MAUI native bridge.

An earlier version of this PR went to OTel Android 1.7 / Java 1.66. That forced compileSdk 37 / AGP 9.1 on every native Android consumer, and Kotlin 2.3+ from OTel Android 1.5 onward. 0.13 is the newest release that keeps today's floor:

Before (0.11) This PR (0.13)
Consumer compileSdk / AGP 35 / 8.6 35 / 8.6 (unchanged)
androidx.core (sets that floor) 1.16 1.16
androidx.lifecycle 2.8.7 2.9.2 (matches what the MAUI package already ships)
kotlin-stdlib pulled by OTel 2.1.20 2.2.0

From 0.14 on, OTel Android pulls androidx.core 1.17+, which needs compileSdk 36 / AGP 8.9.1.

I checked the floor by reading the AAR metadata of every artifact on the library's release runtime classpath. The highest values are minCompileSdk=35 and minAgp=8.6.0.

Code changes

  • Session API. 0.13 removed SessionManager and SessionIdGenerator; the session module now has only Session, SessionObserver, SessionProvider and SessionPublisher.
    • LDSessionManager now implements SessionProvider + SessionPublisher.
    • It's installed with OpenTelemetryRumBuilder.setSessionProvider, which is public in 0.13, so LDRumSessionManagerAccessor (the package-private workaround) is deleted.
    • The replay classes that took a SessionManager now take a SessionProvider.
  • MAUI native module. LDObserve/build.gradle.kts pins kotlin-stdlib to 2.0.21, matching what observability-android/lib already does. Without the pin, the module's Kotlin 2.0.21 compiler can't read the stdlib 2.2 metadata.
  • e2e app.
    • OTel versions are aligned to 0.13 / 1.52.
    • OkHttp and MockWebServer move to 5.1.0, because opentelemetry-exporter-sender-okhttp 1.52 pulls OkHttp 5 and the 4.x MockWebServer can't run on it.
    • MockWebServer 5 records the host as 127.0.0.1, so the URL comparison helpers in DisablingConfigOptionsE2ETest normalize it.

The library's own runtime classpath stays on OkHttp 4.12. OkHttp 5 only comes in where the OTel OkHttp sender is used: in the e2e app, and shaded inside ldobserve-otel-bundle.jar for MAUI.

Verification

  • e2e (same tasks as CI): :app:checkComposeDebugAarMetadata, :app:checkComposeReleaseAarMetadata and :app:assembleComposeRelease pass. :app:testComposeDebugUnitTest passes 15 tests (1 skipped).
  • Library unit tests: :observability-android:testDebugUnitTest passes 535 tests (2 skipped).
  • MAUI:
    • The LDObserve.Android.Binding Release build passes.
    • The MauiSample10 net10.0-android Release build passes with R8.
    • On an emulator, the sample exported traces and logs to a local OTLP capture server through the shaded OkHttp 5.
    • The payloads report telemetry.sdk.version 1.52.0, and spans and logs carry the same session.id.

Notes

  • The MAUI AAR allowlist (NativeAndroidDeps.props) is unchanged. 0.13 adds a sessions instrumentation AAR, which android-agent depends on. Like crash today, it isn't shipped. Instrumentations are discovered through ServiceLoader, so a missing AAR just means that instrumentation doesn't load, and no new session start/end events appear in MAUI apps.
  • The Kotlin floor for native Android consumers moves from 2.0 to 2.1, since OTel's stdlib goes from 2.1.20 to 2.2.0 and a compiler reads metadata up to one version ahead of itself.

abelonogov-ld and others added 10 commits October 2, 2026 17:00
…ndled okio/okhttp

- Bump OpenTelemetry Java 1.51.0 -> 1.66.0 and OpenTelemetry Android 0.11.0-alpha -> 1.7.0
  in observability-android and the MAUI LDObserve native module; migrate to the split
  SessionProvider/SessionPublisher API, RumBuilder, and the new AttributeType.VALUE /
  ValueType.EMPTY cases.
- Pin kotlinx-coroutines, kotlin-stdlib, androidx.core and okhttp to versions the current
  Kotlin 2.0.21 / AGP 8.x toolchain can build against.
- Drop the Org.Jetbrains.Kotlinx.KotlinxSerializationJson NuGet dependency. Its JVM package
  injects a jar from a hardcoded Gradle cache path, which duplicated
  kotlinx.serialization.json classes in apps using Xamarin.KotlinX.Serialization.Json.
- Relocate the okio and okhttp3 classes bundled in ldobserve-otel-bundle.jar under
  com.launchdarkly.sessionreplay.shaded so they no longer collide with Square.OkIO
  (R8 'defined multiple times' failure in Release builds, e.g. via Firebase).
- Update NativeAndroidDeps.props globs for the renamed OTel Android 1.x artifacts.
- Fix ObservabilityBridge for the pageViews -> screenViews rename.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add MauiSample10.csproj (net10.0-android/ios) sharing sources with MauiSample9, with
  isolated obj/bin paths.
- Reference Xamarin.Firebase.Messaging/Analytics on Android as a standing check against
  the Square.OkIO / KotlinX duplicate-class conflicts (exercised by Release builds).
- Guard CommunityToolkit.Maui Popup API differences (v11 vs v15) in DialogsPage.
- Show platform, .NET runtime version and Debug/Release in the shell title.
- Remove global.json so the .NET 10 SDK can build the tree.

Co-authored-by: Cursor <cursoragent@cursor.com>
… consumer apps

0.11.1 raised Xamarin.AndroidX.Lifecycle.* floors to 2.11.0.1, which requires
SavedState >= 1.5.0.1 and Collection.Jvm >= 1.6.0.1 and conflicts with our
SavedState 1.3.1.1 / Collection 1.5.0.3 floors, producing NU1605 downgrade
errors in MAUI apps (e.g. MauiPlanets on MAUI 9). Our Java only uses lifecycle
APIs present in 2.9 (ProcessLifecycleOwner, DefaultLifecycleObserver), so go
back to the 2.9.2.1 line MAUI itself ships.

Stop suppressing NU1605/NU1608 in MauiSample10 so the sample catches this, and
bump the package version to 0.11.2.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The okio/okhttp relocation is what fixes the R8 duplicate-class failure in
Release, and it is independent of the OTel version: 0.10.2, which shipped on
OTel 1.51, already bundles 433 unshaded okio/okhttp3 entries including the
okio/-DeflaterSinkExtensions that R8 rejects.

Upgrading to OTel Android 1.7 pulls androidx.core 1.19, androidx.lifecycle 2.11
and okhttp-android 5.4, which require compileSdk 36-37 and AGP 9.1. That breaks
every native Android consumer still on AGP 8, including our own e2e app, and is
a migration the Android owners should land on its own schedule.

Reverts the version bumps and the observability-android changes that existed
only to track the 1.x API. Keeps the relocation, the Lifecycle floors, the
.NET 10 sample and the Analytics.screenViews fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Restores the upgrade that was split out of #791 so the MAUI Release fix could
ship without it.

Not ready to merge as-is. OTel Android 1.7 pulls androidx.core 1.19,
androidx.lifecycle 2.11 and okhttp-android 5.4, which declare a minimum
compileSdk of 36-37 and AGP 9.1. The e2e app (compileSdk 35, AGP 8.13.2) fails
checkComposeDebugAarMetadata on them, and so will any consumer still on AGP 8.
The resolutionStrategy pins in lib/build.gradle.kts only hold inside this
build; they are not published, so consumers see the raw transitives.

Landing this needs an AGP 9 / compileSdk 37 migration first, or a decision to
pin the transitives in the published POM.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
OTel Android 1.7 forced consumers to compileSdk 37 / AGP 9.1, and 1.5+ needs
Kotlin 2.3+. 0.13 is the last release whose transitives keep the floor at
compileSdk 35 / AGP 8.6 (androidx.core 1.16).

- Adapt to the 0.13 session API: SessionManager/SessionIdGenerator are gone,
  so LDSessionManager implements SessionProvider + SessionPublisher and is
  installed with the now-public OpenTelemetryRumBuilder.setSessionProvider,
  replacing LDRumSessionManagerAccessor.
- Pin kotlin-stdlib to 2.0.21 in the MAUI LDObserve module, matching the lib.
- e2e: align OTel versions and move OkHttp/MockWebServer to 5.1.0 (pulled by
  exporter-sender-okhttp 1.52); MockWebServer 5 records 127.0.0.1 as host.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld abelonogov-ld changed the title feat(android): upgrade to OTel Java 1.66 and OTel Android 1.7 feat(android): upgrade to OTel Android 0.13 and OTel Java 1.52 Oct 6, 2026
Base automatically changed from feat/maui-otel-upgrade-net10 to main October 6, 2026 19:24

This branch has not been deployed

No deployments
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