Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts and crashes react-native-video on android #1694

Closed
ceddymuhoza opened this issue Sep 1, 2022 · 9 comments
Closed

Conflicts and crashes react-native-video on android #1694

ceddymuhoza opened this issue Sep 1, 2022 · 9 comments
Labels

Comments

@ceddymuhoza
Copy link

Describe the Bug
It looks like when this package is used with react-native-video, all the Exoplayer classes are wiped out upon running.

You get this error

2022-09-01 03:02:20.468 9402-9402/com.myradio E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.myradio, PID: 9402
    java.lang.NoSuchMethodError: No direct method <init>(Lcom/google/android/exoplayer2/trackselection/ExoTrackSelection$Factory;)V in class Lcom/google/android/exoplayer2/trackselection/DefaultTrackSelector; or its super classes (declaration of 'com.google.android.exoplayer2.trackselection.DefaultTrackSelector' appears in /data/app/com.myradio-2/base.apk)
        at com.brentvatne.exoplayer.ReactExoplayerView.initializePlayerCore(ReactExoplayerView.java:551)
        at com.brentvatne.exoplayer.ReactExoplayerView.access$1100(ReactExoplayerView.java:113)
        at com.brentvatne.exoplayer.ReactExoplayerView$6.run(ReactExoplayerView.java:501)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

Steps To Reproduce
How can someone else reproduce this bug?

Create a new project and add the 2 packages, react-native-video and react-native-track-player.

When you remove react-native-track-player, react-native-video works, but when you run both, the video player crashes with the above error.

PS: react-native-track-player can run with or without react-native-video, this only effects the video.

Code To Reproduce
Please provide a simple code example that allows others to replicate the bug.

Link to demo repo

Environment Info:
Paste the results of npx react-native info

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-4570R CPU @ 2.70GHz
    Memory: 541.84 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.19.3 - /usr/local/opt/node@14/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.17 - /usr/local/opt/node@14/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8815526
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: 0.69.5 => 0.69.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Paste the exact react-native-track-player version you are using

3.1.0

Real device? Or simulator?

simulator

What OS are you running?

Android

How I can Help
What can you do to help resolve this?
Have you investigated the underlying JS or Swift/Android code causing this bug?

found this in react-native-track-player/android/proguard-rules.txt, removed it but it didn't work

-dontwarn com.google.android.exoplayer2.**

Can you create a Pull Request with a fix?

@ceddymuhoza ceddymuhoza added the Bug label Sep 1, 2022
@ceddymuhoza
Copy link
Author

it looks similar to #287

@stereodenis
Copy link

Same issue for me

@KrisLau
Copy link

KrisLau commented Sep 1, 2022

also looks similar to the problem I have with react-native-track-player #1633 (comment)

@KrisLau
Copy link

KrisLau commented Sep 2, 2022

It's likely to be a exoplayer version mismatch:

@ceddybi
Copy link

ceddybi commented Sep 3, 2022

@KrisLau but v6.0.0-alpha.1 is using exoplayer 2.17.1,

as with duplicated exoplayers, i don't think rntp has exoplayer as a dependency

@ceddybi
Copy link

ceddybi commented Sep 3, 2022

@KrisLau Yes rntp uses 2.18.1 just confirmed from 'com.github.DoubleSymmetry:KotlinAudio'

@jspizziri
Copy link
Collaborator

@KrisLau is correct. We're using v2.18.1 in v3.1. In previous versions of RNTP you used to be able to specify the version of ExoPlayer. However, that is no longer possible. ExoPlayer introduces breaking changes in minor versions unfortunately so things like this are going to be hard or impossible to prevent on our end.

All I can say is, for those having this issue, wait until react-native-video updates to the newest version of ExoPlayer.

@karltaylor
Copy link
Contributor

If anyone comes across this, 6.0.0-alpha.3 worked for me

@KrisLau
Copy link

KrisLau commented Oct 26, 2022

@karltaylor Yup that's the version with the fix! You'll also need to upgrade your expo to expo@47.0.0-alpha.1 i believe according to expo/expo#18937 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants