Skip to content

fix: [SDK-4192] downgrade Kotlin from 2.2.0 to 1.9.25#2601

Merged
fadi-george merged 4 commits intomainfrom
fadi/sdk-4192-downgrade-kotlin-version-in-android-sdk-from-220-to-1925
Apr 7, 2026
Merged

fix: [SDK-4192] downgrade Kotlin from 2.2.0 to 1.9.25#2601
fadi-george merged 4 commits intomainfrom
fadi/sdk-4192-downgrade-kotlin-version-in-android-sdk-from-220-to-1925

Conversation

@fadi-george
Copy link
Copy Markdown
Contributor

@fadi-george fadi-george commented Apr 7, 2026

Description

One Line Summary

Downgrade Kotlin from 2.2.0 to 1.9.25 to maximize compatibility with consuming projects (including wrapper SDKs on Kotlin 1.9.x).

Details

Motivation

The otel crash reporting PR (#2511) bumped Kotlin from 1.9.25 to 2.2.0. This forces all consumers of the SDK to use Kotlin 2.x, which is a messy change for wrapper SDKs (Flutter, React Native, Cordova, Capacitor, Unity, .NET) and any app still on Kotlin 1.9.x. Since no Kotlin 2.x language features are used in the SDK source code, downgrading to 1.9.25 restores the widest compatibility window — consumers on both 1.9.x and 2.x can use the SDK.

Scope

  • SDK build files: kotlinVersion reverted to 1.9.25 in OneSignalSDK/build.gradle
  • Otel module: Added -Xskip-metadata-version-check compiler flag to handle transitive dependencies (okio via OkHttp via OpenTelemetry OTLP exporter) compiled with Kotlin 2.x metadata. This is a compile-time-only metadata check skip; binary compatibility is maintained.
  • Test fix: OtelIntegrationTest.kt required an explicit !! non-null assertion that Kotlin 2.x's improved smart casts had made unnecessary.
  • Demo app: Replaced the Kotlin 2.0+ org.jetbrains.kotlin.plugin.compose plugin with the pre-2.0 composeOptions approach using Compose compiler extension 1.5.15 (the version compatible with Kotlin 1.9.25). Also renamed user-facing "Activity" labels to "Screen".
  • No source code changes in the SDK itself — only build config and one test fix.

Testing

Unit testing

  • assembleRelease builds successfully (all modules including otel)
  • :OneSignal:otel:testReleaseUnitTest passes
  • :OneSignal:core:testReleaseUnitTest passes (2 pre-existing SDKInitTests failures unrelated to this change — also fail on main)

Manual testing

Build verified locally via ./gradlew assembleRelease — all 358 tasks succeeded.
Screenshot 2026-04-07 at 10 39 57 AM
Screenshot 2026-04-07 at 10 38 16 AM

Check crash still logs:

Affected code checklist

  • 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
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

Made with Cursor

}

sharedPreferences.edit()
sharedPreferences!!.edit()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we avoid the !! instead add .?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated to use lateinit var

@fadi-george fadi-george merged commit b1aa75d into main Apr 7, 2026
6 of 7 checks passed
@fadi-george fadi-george deleted the fadi/sdk-4192-downgrade-kotlin-version-in-android-sdk-from-220-to-1925 branch April 7, 2026 18:02
@fadi-george fadi-george changed the title chore: [SDK-4192] downgrade Kotlin from 2.2.0 to 1.9.25 fix: [SDK-4192] downgrade Kotlin from 2.2.0 to 1.9.25 Apr 7, 2026
@fadi-george fadi-george mentioned this pull request Apr 7, 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.

2 participants