Skip to content

fix(android): add missing transitive deps for native core 5.8.0+#176

Merged
fadi-george merged 2 commits into
mainfrom
fadi/sdk-4418-bug-v615-failed-resolution-lkotlinx-serialization-jsonjsonkt
Apr 30, 2026
Merged

fix(android): add missing transitive deps for native core 5.8.0+#176
fadi-george merged 2 commits into
mainfrom
fadi/sdk-4418-bug-v615-failed-resolution-lkotlinx-serialization-jsonjsonkt

Conversation

@fadi-george

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Adds the new Kotlin and AndroidX transitive dependencies that the bundled Android native core 5.8.0 requires, fixing a runtime ClassNotFoundException for kotlinx.serialization.json.JsonKt on app startup.

Fixes #175 (SDK-4418).

Details

Motivation

The 6.1.5 release bumped the bundled Android native AARs from 5.7.x to 5.8.0, which added new runtime dependencies in its POM (kotlinx-serialization-json, lifecycle-viewmodel-ktx, lifecycle-runtime-ktx, activity-ktx) and bumped existing ones (kotlinx-coroutines-* 1.6.4 to 1.7.3). In Xamarin/.NET Android binding projects, AAR POM transitives are not auto-resolved, so the new dex classes never make it into consumer APKs. The native FeatureFlagsJsonParser static initializer touches kotlinx.serialization.json.JsonKt on first use during init and crashes immediately.

java.lang.ClassNotFoundException: Didn't find class "kotlinx.serialization.json.JsonKt" ...
    at com.onesignal.core.internal.backend.impl.FeatureFlagsJsonParser.<clinit>(FeatureFlagsJsonParser.kt:37)
    at com.onesignal.core.internal.backend.impl.FeatureFlagsBackendService.fetchRemoteFeatureFlags(FeatureFlagsBackendService.kt:65)

Scope

Android only. Updates OneSignalSDK.DotNet.Android.csproj and the net10.0-android21.0 group in OneSignalSDK.DotNet.nuspec so the new packages flow through to consumers. iOS, .NET Standard, public API, and runtime behavior are unchanged.

Version mapping vs the native core 5.8.0 POM:

Native NuGet binding
kotlinx-serialization-json:1.6.3 (NEW) Xamarin.KotlinX.Serialization.Json 1.7.3.5 (no 1.6.3 binding exists; 1.7.3 is binary compatible)
kotlinx-coroutines-core:1.7.3 (was 1.6.4) Xamarin.KotlinX.Coroutines.Core 1.7.3.3
kotlinx-coroutines-android:1.7.3 (was 1.6.4) Xamarin.KotlinX.Coroutines.Android 1.7.3.3
lifecycle-viewmodel-ktx:2.6.2 (NEW) Xamarin.AndroidX.Lifecycle.ViewModel.Ktx 2.6.2.3
lifecycle-runtime-ktx:2.6.2 (NEW) Xamarin.AndroidX.Lifecycle.Runtime.Ktx 2.6.2.3
activity-ktx:1.7.2 (NEW) Xamarin.AndroidX.Activity.Ktx 1.7.2.2

Testing

Manual testing

  • dotnet restore OneSignalSDK.DotNet.Android.csproj resolves the new package graph cleanly.
  • dotnet build OneSignalSDK.DotNet.Android.csproj -c Release succeeds with 0 errors (warnings are pre-existing).
  • Reproduction from the linked issue (cold start crash on Android during FeatureFlagsBackendService.fetchRemoteFeatureFlags) should be gone since the missing dex classes are now packaged into the consumer APK.

Affected code checklist

  • Android packaging / dependency graph
  • Notifications
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • No public API changes

Testing

  • All automated tests pass
  • Build verified locally

Final pass

  • I have reviewed this PR myself

Made with Cursor

@fadi-george fadi-george requested a review from a team as a code owner April 30, 2026 18:41

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward dependency fix matching the native Android core 5.8.0 POM, with csproj and nuspec kept in sync.

Extended reasoning...

Overview

This PR modifies only two files: OneSignalSDK.DotNet.Android.csproj and OneSignalSDK.DotNet.nuspec. It bumps Xamarin.KotlinX.Coroutines.Core/Android from 1.6.4.2 to 1.7.3.3, adds Xamarin.KotlinX.Serialization.Json 1.7.3.5, and adds three Ktx AndroidX packages (Lifecycle.ViewModel.Ktx 2.6.2.3, Lifecycle.Runtime.Ktx 2.6.2.3, Activity.Ktx 1.7.2.2) to fix a ClassNotFoundException for kotlinx.serialization.json.JsonKt on app startup after the native core was bumped to 5.8.0.

Security risks

None. This is a packaging/dependency manifest change — no logic, no auth/crypto, no input handling. The added packages are official Xamarin bindings for well-known Kotlin/AndroidX libraries that the native AAR already requires at runtime.

Level of scrutiny

Low. This is a mechanical configuration fix where the csproj <PackageReference> entries and the nuspec <dependency> entries are kept in lockstep (same IDs and versions in both files). The version mapping is documented in the PR description against the native 5.8.0 POM. No code paths or public API are touched.

Other factors

The PR description includes a clear repro (the FeatureFlagsJsonParser static-init stack trace from issue #175) and notes that the build/restore succeed locally. The reordering of Xamarin.AndroidX.Work.Work.Runtime.Ktx is cosmetic. Confident enough in correctness to shadow-approve.

@fadi-george

fadi-george commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

Android + Dotnet Appium Tests:
Spec Files: 12 passed, 12 total (100% completed) in 00:04:53

@fadi-george fadi-george merged commit d0f005f into main Apr 30, 2026
5 checks passed
@fadi-george fadi-george deleted the fadi/sdk-4418-bug-v615-failed-resolution-lkotlinx-serialization-jsonjsonkt branch April 30, 2026 19:30
@claude claude Bot mentioned this pull request May 4, 2026
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.

[Bug]: [v6.1.5] Failed resolution lkotlinx / serialization json/JsonKT

2 participants