NativeModule.RNDeviceInfo is null. code example

Example: rndeviceinfo is null

I'm using Version : ^7.1.0

react-native link react-native-device-info
_________________________________________________________________________

// Include this in your settings.gradle
// also check if this is commented
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-device-info'
_________________________________________________________________________

// Include this in your MainApplication.java
// also check if this is commented
import com.learnium.RNDeviceInfo.RNDeviceInfo;
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
               ...Previous code
				new RNDeviceInfo(),
_________________________________________________________________________
                
// Include this in your android >app >build.gradle
// also check if this is commented                
android {...}
dependencies {
    ...Previous code
    implementation project(path: ':react-native-device-info')

Tags:

Misc Example