fix(android): add missing transitive deps for native core 5.8.0+#176
Conversation
There was a problem hiding this comment.
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.
|
Android + Dotnet Appium Tests: |
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
ClassNotFoundExceptionforkotlinx.serialization.json.JsonKton 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 nativeFeatureFlagsJsonParserstatic initializer toucheskotlinx.serialization.json.JsonKton first use during init and crashes immediately.Scope
Android only. Updates
OneSignalSDK.DotNet.Android.csprojand thenet10.0-android21.0group inOneSignalSDK.DotNet.nuspecso 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:
kotlinx-serialization-json:1.6.3(NEW)Xamarin.KotlinX.Serialization.Json1.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.Core1.7.3.3kotlinx-coroutines-android:1.7.3(was 1.6.4)Xamarin.KotlinX.Coroutines.Android1.7.3.3lifecycle-viewmodel-ktx:2.6.2(NEW)Xamarin.AndroidX.Lifecycle.ViewModel.Ktx2.6.2.3lifecycle-runtime-ktx:2.6.2(NEW)Xamarin.AndroidX.Lifecycle.Runtime.Ktx2.6.2.3activity-ktx:1.7.2(NEW)Xamarin.AndroidX.Activity.Ktx1.7.2.2Testing
Manual testing
dotnet restore OneSignalSDK.DotNet.Android.csprojresolves the new package graph cleanly.dotnet build OneSignalSDK.DotNet.Android.csproj -c Releasesucceeds with 0 errors (warnings are pre-existing).FeatureFlagsBackendService.fetchRemoteFeatureFlags) should be gone since the missing dex classes are now packaged into the consumer APK.Affected code checklist
Checklist
Overview
Testing
Final pass
Made with Cursor