react-native-video: Build fails with react native 0.65 (android only)
Bug
Android build fails when using react-native-video with react native 0.65.
Platform
Which player are you experiencing the problem on:
- Android ExoPlayer (I guess that’s the default?)
Environment info
React native info output:
info Fetching system and libraries information...
System:
OS: macOS 11.5.2
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 33.53 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.4.0 - /var/folders/r4/pdxxhfbj3cqg_0n5th1p2t400000gn/T/yarn--1629982469013-0.5589450802855631/node
Yarn: 1.22.11 - /var/folders/r4/pdxxhfbj3cqg_0n5th1p2t400000gn/T/yarn--1629982469013-0.5589450802855631/yarn
npm: 7.18.1 - /usr/local/bin/npm
Watchman: 2021.08.02.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.2 - /Users/jafar/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.0, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7621141
Xcode: 13.0/13A5212g - /usr/bin/xcodebuild
Languages:
Java: 12.0.2 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.65.1 => 0.65.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
✨ Done in 2.86s.
Library version: 5.1.1
Steps To Reproduce
npx react-native init TestRNVideoyarn install react-native-videoyarn android
$ yarn android
yarn run v1.22.11
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 898 file(s) to forward-jetify. Using 12 workers...
info JS server already running.
* daemon not running; starting now at tcp:5037
* daemon started successfully
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Task :app:mergeDebugAssets FAILED
8 actionable tasks: 8 executed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.yqritc:android-scalablevideoview:1.0.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/[...]/.m2/repository/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/[...]/test/TestRNVideo/node_modules/react-native/android/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/[...]/test/TestRNVideo/node_modules/jsc-android/dist/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://dl.google.com/dl/android/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://www.jitpack.io/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
Required by:
project :app > project :react-native-video
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 14s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.yqritc:android-scalablevideoview:1.0.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/[...]/.m2/repository/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/[...]/test/TestRNVideo/node_modules/react-native/android/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- file:/[...]/test/TestRNVideo/node_modules/jsc-android/dist/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://dl.google.com/dl/android/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
- https://www.jitpack.io/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom
Required by:
project :app > project :react-native-video
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 14s
at makeError (/[...]/test/TestRNVideo/node_modules/execa/index.js:174:9)
at /[...]/test/TestRNVideo/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/[...]/test/TestRNVideo/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5)
at async Command.handleAction (/[...]/test/TestRNVideo/node_modules/@react-native-community/cli/build/index.js:186:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behaviour
- It builds without error.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 25 (1 by maintainers)
I would advice to define the package so other dependencies are not fetched/taken from jCenter anymore. Because jCenter does not allow any updates anymore of any package all other packages should be taken from mavenCentral for example.
You can add jcenter to
android/build.gradlelike this:Hopefully somebody updates android-scalablevideoview to use another repository
jcenter()was removed in favor ofmavenCentral()in 0.65, add it back toallprojects.repositoriesand it’ll magically work again.Adding jcenter() is not a working solution anymore
cd android ./gradlew clean and than : ` allprojects { repositories { … # Keep the rest jcenter() { content { includeModule(“com.yqritc”, “android-scalablevideoview”) } } } }
`
If you are like me and cannot wait for a working release. I patched the
react-native-video@5.2.0like this:Applying the changes which should come with v5.2.1: https://github.com/react-native-video/react-native-video/commit/63f12eaed666ebddf9a506889bf99232c2ea6c20
Applying changes from @MatrixFrog: https://github.com/yqritc/Android-ScalableVideoView/issues/52#issuecomment-1013824489 https://www.jitpack.io/#MatrixFrog/Android-ScalableVideoView/v1.0.4-jitpack
For the patch to work what you need to do is:
react-native-videoandroid-exoplayer/gradle.buildand apply the changes from point 1android/gradle.buildand apply changes from point 2npx patch-package react-native-video(this will create a patch)Now it should work until they release a new stable working version, which I also hope will be soon…
Cheers!
Hmm weird, worked for me just adding jcenter back
I was able to use
react-native-video 5.2.0without using jcenter by switching to the Android ExoPlayer.android-scalablevideoviewis only used by the Android MediaPlayer which is being removed in version 6.x of react-native-video anyway.react-native-video/android-exoplayer/build.gradleaboutcom.google.android.exoplayer:exoplayer:2.13.2andcom.google.android.exoplayer:extension-okhttp:2.13.2not being available. I made a patch to change both versions to2.13.3, and my app built successfully after that.https://github.com/yqritc/Android-ScalableVideoView/issues/52#issuecomment-1013824489
You can add jcenter to android/build.gradle like this:
jcenter() //add this line