RNDeviceInfo is null

See original GitHub issue

Bug

Trying to run a clean project on Android causes the red error screen with the message:

Error: @react-native-community/react-native-device-info: NativeModule.RNDeviceInfo is null.

Environment info

React native info output:

System:
    OS: macOS Mojave 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 154.95 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.14.1 - ~/.nvm/versions/node/v10.14.1/bin/node
    Yarn: 1.17.3 - ~/.nvm/versions/node/v10.14.1/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v10.14.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 26, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.0/11A420a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.1 => 0.61.1

Library version: 3.1.4

Steps To Reproduce

  1. create clean project with (RN 0.61.1):
react-native init test
  1. yarn add react-native-device-info
  2. cd ios && pod install && cd … (with success message)
  3. add code:
import DeviceInfo from 'react-native-device-info';
...
DeviceInfo.isTablet().then(isTablet => {
    console.log(isTablet);
});
  1. Project presents red screen on Android.
  2. Project runs just fine on iOS.

(Oddly enough, if I perform the manual linking steps [despite running RN0.61.1] the Android project runs fine then)

Describe what you expected to happen:

  1. Both iOS and Android runs should fine and log wether if the device is a tablet or not.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
johnhiggscommented, Oct 2, 2019

Im having an issue trying to use a private repo with the new testing-library for react-native (.59)

My hunch is that if we can upgrade to .61 the issue will go away, ive tried performing manual link, xcode build, pod install etc

1reaction
mikehardycommented, Oct 2, 2019

posting me-toos does not work. I need someone to clone this repo, run the example, and tell me it does not work.

Here’s what I did

git clone git@github.com:react-native-community/react-native-device-info.git
cd react-native-device-info
./refresh-example.sh
cd example
yarn ios

It works. Any evidence to the contrary I/we are all over it. In the meantime, something is wrong with project integration at the project-specific level and that’s not something we can control or even really troubleshoot effectively, which is why we provide not only an example but an example built by a script you may inspect to make sure you can reproduce actual example construction

I’m not sure what more I/we can do?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NativeModule.RNDeviceInfo is null. To fix this issue these ...
Try running the command. react-native link react-native-device-info. or. cd ios && pod install && cd .. Then try running your project again ...
Read more >
NativeModule.RNDeviceInfo is NULL - Expo Development Tools
# Bug Trying to use react-native-device-info for the first time and I'm getting… this error when the application tries to start up: node_modules ......
Read more >
react-native-device-info - UNPKG
RNDeviceInfo is null. To fix this issue try these steps: 21, • For react-native <= 0.59: Run \`react-native link react-native-device-info\` in the project ......
Read more >
react-native-device-info - npm
Linking in native modules is a frequent source of trouble for new react-native developers, resulting in errors like "RNDeviceInfo is null" ...
Read more >
In test ONLY: @react-native-community/react-native-device-info
In test ONLY: @react-native-community/react-native-device-info: NativeModule.RNDeviceInfo is null.
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