TheWidlarzGroup/react-native-video

Error React Native CLI uses autolinking for native dependencies

Closed this issue ยท 4 comments

Bug

This error occurs when building a React Native 0.60 app:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
  - react-native-video (to unlink run: "react-native unlink react-native-video")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

The README still says that you need to run this, which might be outdated. I'm not sure.

react-native link react-native-video

I don't know if react-native-video supports autolinking, and I didn't see any other GitHub issues for this, so I am opening this issue just in case it's not yet supported, or to help anyone else who is also wondering.

Environment info

React native info output:

System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 27.36 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.17.3 - ~/.yarn/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.15.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 26.0.2, 27.0.3, 28.0.3
  IDEs:
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5

Library version: 5.0.2

Steps To Reproduce

  1. Follow steps described in README for v5

Describe what you expected to happen:

  1. Either an explanation in README explaining that it is necessary to link, or updated to remove that manually linking is no longer necessary

Using autolinking in react-native 0.60, react-native-video defaults to use the old Android MediaPlayer instead of ExoPlayer. I am not quite sure how to choose ExoPlayer without giving up on autolinking.

create config file name react-native.config.js in project auto link exoplayer

module.exports = {
dependencies: {
'react-native-video': {
platforms: {
android: {
sourceDir: '../node_modules/react-native-video/android-exoplayer',
},
},
},
},
};

It'd be good to add @nhjuhoang's snippet to the readme as well - I upgraded React Native on an existing project and autolinking was working fine, but I was going crazy trying to decipher the playback error messages.

Turned out it had fallen back to MediaPlayer automatically, when all the rest of the code and settings were configured for ExoPlayer. After adding the config changes worked perfectly.

This is very scary. After upgrading RN and moving to auto linking - our app started using the older default player instead of ExoPlayer. Strongly feel that ExoPlayer should have been the default when using auto-linking...