question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't run the project after installing react-native-video

See original GitHub issue

Current behavior

After adding the react-native-video to the newly created project I get this error when I want to run the project (android):

info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
> Task :react-native-video:javaPreCompileDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':react-native-video:debugCompileClasspath'.
> Could not find support-compat.jar (com.android.support:support-compat:28.0.0).
  Searched in the following locations:
      https://dl.google.com/dl/android/maven2/com/android/support/support-compat/28.0.0/support-compat-28.0.0.jar

* 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 7s
14 actionable tasks: 11 executed, 3 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

Reproduction steps

I create a new react-native project, and everything runs ok.

$ react-native init MyTestProject
$ cd MyTestProject
$ react-native run-android

Then I add react-native-video to my project according to the documentations.

npm install --save react-native-video
react-native link react-native-video

then when I run the project I got the above error:

$ react-native run-android

package.json

{
  "name": "MyTestProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.8"
  },
  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@babel/runtime": "^7.4.4",
    "babel-jest": "^24.8.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.54.0",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
 
allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

Expected behavior

Project should run without error.

Platform

Android

Video sample

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

3reactions
ali-shahsvndcommented, Jun 12, 2019

@tjann @Hadi290 @rezareact node_modules/react-native-video/android-exoplayer/build.gradle add @aar at this line

implementation “com.android.support:support-compat:${safeExtGet(‘supportLibVersion’, ‘+’)}@aar

2reactions
art1373commented, Apr 7, 2020

I am still having issues with this rn version : 0.61.4

fixed npm i react-native-video@5.0.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't run the project after installing react-native-video #1587
After adding the react-native-video to the newly created project I get this error when I want to run the project (android):. info Starting...
Read more >
Can't run the project after installing react-native-video
I add react-native-video to my project according to the documentation. Looks like you added the compile('react-native-video') in your android/ ...
Read more >
React Native Video by Example - All Issues Resolved - SiteReq
To add the React Native video plugin to your app, make sure that your terminal is navigated to the project root directory and...
Read more >
Troubleshooting - React Native
If you added React Native manually to your project, make sure you have included all the relevant dependencies that you are using, like...
Read more >
Not able to run React native app using Video SDK
When i try to run the video SDK react Native App getting following error. error Failed to install the app. Make sure you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found