'Could not find com.yqritc:android-scalablevideoview:1.0.4 react-native-video in Android

I want to use react-native-video in my project. After installing this package I got this error every time (Only in android). I have added all the additional codes that are given in the documentation.

My react-native version is: 0.66.3

And react-native-video version is: 5.2.0

Is there any way to get rid of this error?



Solution 1:[1]

jCenter does not allow to update package anymore, all other packages should be taken from mavenCentral.

You can add jcenter to android/build.gradle like this:

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

Solution 2:[2]

This issue seems to happen with react-native-video. For those who are having issues with jcenter() being deprecated, heres how to resolve:

  1. replace react-native-video in package.json with "react-native-video": "https://github.com/MatrixFrog/react-native-video#11ca8a6799f932a5f24da85dfe68c696ad13a753"

  2. In android/build.gradle, add maven { url 'https://www.jitpack.io' } in repositories, it should look like:

allprojects {
        repositories {
            ...
            maven { url 'https://www.jitpack.io' }
        }
    }

  1. In android/app/build.gradle add implementation 'com.github.MatrixFrog:Android-ScalableVideoView:v1.0.4-jitpack'

  2. delete your package-lock.json and node_modules, and reinstall.

  3. clean/rebuild in android studio.

and voala.

Solution 3:[3]

If you don't want to add jcenter to all your project nor use a forked library, you can patch the package on your project with patch-package. For this :

  1. go to node_modules/react-native-video/android/build.gradle and add the below fix to your package
diff --git a/node_modules/react-native-video/android/build.gradle b/node_modules/react-native-video/android/build.gradle
index 2fb8dfd..eb7ecdf 100644
--- a/node_modules/react-native-video/android/build.gradle
+++ b/node_modules/react-native-video/android/build.gradle
@@ -19,8 +19,12 @@ android {
     }
 }
 
+repositories {
+    maven { url 'https://www.jitpack.io' }
+}
+
 dependencies {
     //noinspection GradleDynamicVersion
     implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
-    implementation 'com.yqritc:android-scalablevideoview:1.0.4'
+    implementation 'com.github.MatrixFrog:android-scalablevideoview:v1.0.4-jitpack'
 }

  1. run npx patch-package react-native-video to apply the patch to your project
  2. Finish the patch-package setup on your project
  3. rebuild your android project with yarn android

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Younis Rahman
Solution 2 Mubeen Hussain
Solution 3 Alex D