1

How Can I add to native module, external library source code. In the case, I want to add a local copy of ExoPlayer to react-native-video module. I want to "git clone" the original source of the ExoPlayer inside react-native-video/android-exoplayer ,make some modifications on it and test it. Currently the depencies of /react-native-video/android-exoplayer/build.gradle are:

dependencies {
    //noinspection GradleDynamicVersion
    provided "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
    compile 'com.google.android.exoplayer:exoplayer:2.7.3'
    compile('com.google.android.exoplayer:extension-okhttp:2.7.3') {
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }
    compile 'com.squareup.okhttp3:okhttp:3.9.1'
}

current file structure:

build

build.gradle

ExoPlayer

/src

This directory "ExoPlayer" I got with "git clone" and want to use instead of

compile 'com.google.android.exoplayer:exoplayer:2.7.3'

Ivan Totev
  • 29
  • 1
  • 4

1 Answers1

0

I found the solution:

In the root Project settings.gradle should add this:

gradle.ext.exoplayerRoot = '../node_modules/react-native-video/android-exoplayer/ExoPlayer-r2.7.3'
gradle.ext.exoplayerModulePrefix = 'exoplayer-'
apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')

In react-native-video/android-exoplayer/build.gradle dependencies section add this:

implementation project(':exoplayer-library-core')
implementation project(':exoplayer-library-hls')
implementation project(':exoplayer-library-smoothstreaming')
implementation project(':exoplayer-library-dash')
implementation project(':exoplayer-library-ui')
implementation project(':exoplayer-extension-okhttp')

and remove all rows started with "compile"

Ivan Totev
  • 29
  • 1
  • 4