I wan't to create a custom native module for my app only - so no lib. Following the docs it gives me an error:
import com.facebook.react.bridge.ReactContextBaseJavaModule;
Cannot resolve symbol 'ReactContextBaseJavaModule'
My app's
android/app/build.gradle
includes this line, which is included in all react-native modules I have used so far as well."com.facebook.react:react-native:+" // From node_modules
My
android/build.gradle
:// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() jcenter() mavenCentral() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.google.com' } } }
Below are the steps I encountered and used to solve importing all the libraries related to React Native Libraries in the Android Studio:
build.gradle
gradle-wrapper.properties
After adding the above 2 changes, Click Sync Now or Try again. In this step if it asks to install the build version, please install.
Now Clean and Rebuild the project, On top status bar of the Android Studio:
Click Build --> Clean Project then
Click Build --> Rebuild Project
After step #5, React Native import errors should disappear and the libraries related to React Native must be imported.
Thanks.