Reputation: 237
After adding the react-native-video to the newly created project I get this error when I want to run the project (android), but once I uninstall it, everything runs ok.
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\myTestApp\myTestApp\android\build.gradle' line: 19
* What went wrong:
A problem occurred evaluating root project 'myTestApp'.
> Could not find method compile() for arguments [project ':react-native-video'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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 9s
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.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\myTestApp\myTestApp\android\build.gradle' line: 19
* What went wrong:
A problem occurred evaluating root project 'myTestApp'.
> Could not find method compile() for arguments [project ':react-native-video'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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 9s
at makeError (C:\myTestApp\myTestApp\node_modules\execa\index.js:174:9)
at C:\myTestApp\myTestApp\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (C:\myTestApp\myTestApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\myTestApp\myTestApp\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
I add react-native-video to my project according to the documentation.
npm install --save react-native-video
cd myTestApp
npm run android
then when I run the project I got the above error
Upvotes: 1
Views: 2907
Reputation: 21
Replace compile project(':react-native-video') to implementation project(':react-native-video')
Could not find method compile() for arguments [com.android.support:appcompat-v7:25.0.0]
Upvotes: 2
Reputation: 237
Found a solution here.
Go to file: node_module/react-native-video/android-exoplayer/build.gradle
change all references of 2.13.2 to 2.13.3
Upvotes: 1