'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:
replace
react-native-video
inpackage.json
with"react-native-video": "https://github.com/MatrixFrog/react-native-video#11ca8a6799f932a5f24da85dfe68c696ad13a753"
In
android/build.gradle
, addmaven { url 'https://www.jitpack.io' }
in repositories, it should look like:
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
In
android/app/build.gradle
addimplementation 'com.github.MatrixFrog:Android-ScalableVideoView:v1.0.4-jitpack'
delete your
package-lock.json
andnode_modules
, and reinstall.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 :
- 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'
}
- run
npx patch-package react-native-video
to apply the patch to your project - Finish the patch-package setup on your project
- 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 |