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.

Unable to get the library working | ReactYouTube does not exist | Missing import

See original GitHub issue

React : 16.3.0-alpha.1 React Native : 0.54.0 React Native Youtube : 1.1.0 Support Library : 27.1.0

Install instructions yarn add react-native-youtube react-native link or if you want to be specific react-native link react-native-youtube

Goto android folder and open the settings.gradle file

Make sure you have the following lines before include ':app'

include ':react-native-youtube'

project(':react-native-youtube').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-youtube/android')

Then goto android/app folder and check the build.gradle file.

You should have a piece of code that looks like this

dependencies { ...... }

Make sure you have implementation project(':react-native-youtube') within the dependencies braces. If you are using an older version of the support library then replace implementation with compile.

Next you need to goto MainApplication.java which you will find under android/app/src/main/java/com/project_name/MainApplication.java.

Once there make sure you have import com.inprogress.reactnativeyoutube.ReactNativeYouTube; as an import.

You will also have a piece of code that looks similar to this along with any other dependency that you may have installed.

@Override
    protected List<ReactPackage> getPackages() {
        return Arrays.asList(
                new MainReactPackage()
        );
    }

Add new ReactNativeYouTube() to it so it looks like this

  @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.asList(
                new MainReactPackage(),
                new ReactNativeYouTube()
        );
    }

At this point you should sync gradle and try running the app.

It helps with debugging if you have android studio installed, make sure the import is detected and make sure the react native youtube module gets created after syncing gradle.

I created this not as an issue as i managed to get it working but to help others who have a similar problem, the author failed to mention the line implementation project(':react-native-youtube') which was missing for me even after linking which I had to manually add. I was able to successfully use the library by following the steps in the above order using the latest react and react native version as mentioned above.

I haven’t checked out the iOS version yet.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:18
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
aiavcicommented, Apr 9, 2018

The issue comes with Android Studio 3.0. You can find the exact issue I’m talking about for another library at this link

The way I was able to resolve it is by adding matchingFallbacks = ['debug'] to all the custom build types.

0reactions
khieudinhhhuucommented, May 7, 2019

Thank you. Vietnamese

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to get the library working | ReactYouTube does not exist
At this point you should sync gradle and try running the app. It helps with debugging if you have android studio installed, make...
Read more >
React unable to import component -- module not found
The problem for me was that import line was not generated correctly. I have this scenario: --src ----elements -----myCustomText.tsx.
Read more >
react-youtube - npm
Start using react-youtube in your project by running `npm i react-youtube`. There are 226 other projects in the npm registry using ...
Read more >
React JS Full Course 2022 | Build an App and ... - YouTube
Are you wondering how to become a React developer? Look no further, and get all the info in one video.The first 1000 people...
Read more >
Converting A Plain JavaScript App To React - YouTube
Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, try restarting your device. Your browser can't play this video.
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