1

如何添加到本机模块、外部库源代码。在这种情况下,我想将 ExoPlayer 的本地副本添加到 react-native-video 模块。我想在 react-native-video/android-exoplayer 中“git clone” ExoPlayer 的原始源,对其进行一些修改并进行测试。目前 /react-native-video/android-exoplayer/build.gradle 的依赖是:

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'
}

当前文件结构:

建造

构建.gradle

ExoPlayer

/src

这个目录“ExoPlayer”是我用“git clone”得到的,想用它代替

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

4

1 回答 1

0

我找到了解决方案:

在根项目 settings.gradle 应该添加这个:

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')

在 react-native-video/android-exoplayer/build.gradle依赖项部分添加:

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')

并删除所有以“编译”开头的行

于 2019-03-23T22:50:29.697 回答