Skip to content

fix: [SDK-4160] exclude OkHttp 5.x from OneSignal transitive dependencies#1921

Merged
fadi-george merged 5 commits intomainfrom
fadi/sdk-4160-bug-onesignal-571-causes-okhttp-runtime-incompatibility
Mar 17, 2026
Merged

fix: [SDK-4160] exclude OkHttp 5.x from OneSignal transitive dependencies#1921
fadi-george merged 5 commits intomainfrom
fadi/sdk-4160-bug-onesignal-571-causes-okhttp-runtime-incompatibility

Conversation

@fadi-george
Copy link
Copy Markdown
Collaborator

@fadi-george fadi-george commented Mar 17, 2026

Description

One Line Summary

Exclude OkHttp 5.x from OneSignal Android SDK's transitive dependencies to prevent runtime crashes in React Native apps.

Details

Motivation

OneSignal Android SDK 5.7.x introduced an otel module that transitively pulls in OkHttp 5.x (okhttp-jvm:5.2.1) via opentelemetry-exporter-sender-okhttp. OkHttp 5.x is binary-incompatible with React Native's networking stack, which references okhttp3.internal.Util (removed in 5.x). Gradle's conflict resolution upgrades the entire app to OkHttp 5.x, causing a NoClassDefFoundError crash at runtime on the first network request.

Dependency chain causing the crash:

com.onesignal:OneSignal:5.7.x
  → com.onesignal:core:5.7.x
    → com.onesignal:otel:5.7.x
      → opentelemetry-exporter-otlp:1.55.0
        → opentelemetry-exporter-sender-okhttp:1.55.0
          → com.squareup.okhttp3:okhttp-jvm:5.2.1

An upstream fix is also being applied to the Android SDK's otel module (OneSignal-Android-SDK#2577). This wrapper-side exclude provides additional protection for React Native users.

Scope

  • Excludes com.squareup.okhttp3:okhttp from the OneSignal dependency's transitive graph
  • React Native already provides OkHttp 4.x, so no additional dependency is needed
  • No public API or behavioral changes

Fixes OneSignal/OneSignal-Android-SDK#2575

Testing

Manual testing

Verified via Gradle dependency insight that OkHttp 5.x no longer appears in the resolved classpath when this exclude is applied.

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


This change is Reviewable

@fadi-george fadi-george requested a review from a team as a code owner March 17, 2026 18:26
@fadi-george fadi-george merged commit 327224d into main Mar 17, 2026
8 checks passed
@fadi-george fadi-george deleted the fadi/sdk-4160-bug-onesignal-571-causes-okhttp-runtime-incompatibility branch March 17, 2026 19:19
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]: OneSignal 5.7.1 causes OkHttp runtime incompatibility crash in React Native app (NoClassDefFoundError okhttp3/internal/Util)

2 participants