Skip to content

[BUG] Android: JWPlayer React Native SDK Crashes Due to Media3 PlayerMessage.setHandler Incompatibility #139

@Mohamed-hamed-32

Description

@Mohamed-hamed-32

Describe the bug
The Android app crashes immediately when initializing or playing media through JWPlayer React Native SDK. The crash occurs due to a method incompatibility between JWPlayer SDK and AndroidX Media3, specifically regarding the PlayerMessage.setHandler method. This is a blocking issue preventing any audio playback functionality in our production app.

To Reproduce
Steps to reproduce the behavior:

  1. Create a React Native project with Expo
  2. Install @jwplayer/jwplayer-react-native
  3. Configure JWPlayer with proper Media3 dependencies in Android configuration
  4. Set up a basic audio player using JWPlayer
  5. Attempt to play any audio stream
  6. App crashes with NoSuchMethodError

Expected behavior

  • JWPlayer should initialize successfully
  • Audio playback should work without crashes
  • Player controls and events should function normally

Screenshots / Visual evidence

Image
Title: [Android] Critical: JWPlayer React Native SDK Crashes Due to Media3 PlayerMessage.setHandler Incompatibility

java.lang.NoSuchMethodError: No virtual method setHandler(Landroid/os/Handler;)Landroidx/media3/exoplayer/PlayerMessage; in class Landroidx/media3/exoplayer/PlayerMessage; or its super classes (declaration of 'androidx.media3.exoplayer.PlayerMessage' appears in /data/app/~~EH-gSvtI9j7TSoNh2SHl3w==/com.mediaworks.therock.beta-qMDl2X3uwuwArtS8vxWDjA==/base.apk!classes6.dex)

To Reproduce
Steps to reproduce the behavior:

  1. Create a new React Native project with Expo
  2. Add the following dependencies:
    • @jwplayer/jwplayer-react-native
    • Required Android configuration in app.config.ts
  3. Initialize JWPlayer with a simple audio configuration:
  4. Run the app on any Android device
  5. App crashes immediately when the JWPlayer component mounts or when attempting to play audio playlist
"streamUrl": "https://example-url/playlist.m3u8",

Desktop:
Build Environment:

  • macOS darwin 24.3.0
  • Android Gradle plugin: 8.6.0
  • Gradle: 8.10.2
  • React Native with Expo managed workflow
  • Node.js version: 20.17.0

Device(s) affected

  • Reproducible on all tested Android devices:
    • Android Emulator (API 30, 31, 33)
    • Physical devices running Android 11-14
    • Both ARM and x86 architectures
  • Reproduction rate: 100%

Additional context
Attempted Solutions:

  1. SDK Versions:

    • JWPlayer SDK versions: 4.19.0, 4.18.4, 4.6.0
    • Media3 versions: 1.4.1, 1.1.1, 1.0.0
    • All combinations result in the same error
  2. Configuration Attempts:

    • Implemented all recommended Android configurations
    • Added complete Media3 dependency set
    • Configured proper Maven repository
    • Enabled multiDex
    • Set appropriate SDK versions
    • Disabled advanced features (background playback, lock screen controls)
  3. Project Setup:

    // app.config.ts
    android: {
      extraMavenRepos: ['https://mvn.jwplayer.com/content/repositories/releases/'],
      minSdkVersion: 24,
      targetSdkVersion: 34,
      compileSdkVersion: 34,
      multiDexEnabled: true,
           // Downgraded Media3 dependencies:
             'androidx.media3:media3-common:1.1.1',
             'androidx.media3:media3-extractor:1.1.1',
             'androidx.media3:media3-exoplayer:1.1.1',
             'androidx.media3:media3-exoplayer-dash:1.1.1',
             'androidx.media3:media3-exoplayer-hls:1.1.1',
             'androidx.media3:media3-exoplayer-smoothstreaming:1.1.1',
             'androidx.media3:media3-session:1.1.1',
             'androidx.media3:media3-datasource-okhttp:1.1.1',
             'androidx.media3:media3-ui:1.1.1',
    
             // JWPlayer dependencies:
             'com.jwplayer:jwplayer-core:4.18.4',
             'com.jwplayer:jwplayer-common:4.18.4',
             'com.jwplayer:jwplayer-ima:4.18.4',
             'com.jwplayer:jwplayer-chromecast:4.18.4',
    
             // Other dependencies:
             'com.squareup.picasso:picasso:2.71828',
             'androidx.viewpager2:viewpager2:1.0.0',
             'com.android.volley:volley:1.2.0',
             'androidx.recyclerview:recyclerview:1.2.1',
             'androidx.appcompat:appcompat:1.3.1',
             'com.google.android.material:material:1.4.0',
             'androidx.constraintlayout:constraintlayout:2.0.4',
           ],
    }

Critical Questions:

  1. Is there a known working combination of JWPlayer SDK and Media3 versions for React Native?
  2. Are there specific configuration requirements for Media3 compatibility?
  3. Is there a workaround available for the setHandler method issue?
  4. Would using ExoPlayer 2.x instead of Media3 be a viable solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-groomingHas not been reviewed by codeowners for scope/validation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions