React-native-video 5.2.0 Android 构建错误 RNC 0.66.3

You*_*man 3 typescript react-native

找不到 com.google.android.exoplayer:exoplayer:2.13.2 每次我尝试在 android 中构建时都会显示此错误。IOS对我来说工作得很好。

我将 jcenter 添加到android/build.gradle中,如下所示:

allprojects {
    repositories {
        .... # rest of your code
        jcenter() {
            content {
                includeModule("com.yqritc", "android-scalablevideoview")
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但这对我不起作用。

在此输入图像描述

Jim*_*han 6

我也遇到过同样的错误!但我没有得到任何完美的解决方案! 我使用一个 hacky 解决方案。您可以尝试一下,节省您的时间!

因此,首先您必须仔细阅读文档。添加所有额外的代码后,你必须去

Project Root folder: node_modules/react-native-video

包.json

"dependencies": {
    ...
    ...
    "shaka-player": "^3.2.1" // Add this line
},
Run Code Online (Sandbox Code Playgroud)

下一个: 前往

/android-exoplayer/build.gradle

dependencies {
    ...
    ...
   - implementation('com.google.android.exoplayer:exoplayer:2.13.2') { // delete this line
   + implementation('com.google.android.exoplayer:exoplayer:2.13.3') {  // add this line
        exclude group: 'com.android.support'
    }

    ...
    ...

   - implementation('com.google.android.exoplayer:extension-okhttp:2.13.2') { // delete this line
   + implementation('com.google.android.exoplayer:extension-okhttp:2.13.3') { // add this line
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }
}
Run Code Online (Sandbox Code Playgroud)

保存!并再次运行您的项目!

注意:如果你删除你的node_modules文件夹,这将不起作用(你必须再次添加它才能正常工作)我认为这个解决方案将在下一个版本的react-native-video中添加

希望你一切顺利!