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.

RNDeviceInfo is null issue on react-native 0.60.4

See original GitHub issue

Bug

RNDeviceInfo is null issue on react-native 0.60.4. Importing it fails with version 2.3.2.

Environment info

React native info output:

 System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
    Memory: 13.90 GB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.8.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.10.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 28
      Build Tools: 28.0.2
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.1 AI-173.4907809
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4 
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

Library version: x.x.x

Steps To Reproduce

  1. Create a new app react-native init MyTestApp
  2. In App.js, import DeviceInfo:

import DeviceInfo from 'react-native-device-info';

  1. npm install it:

npm install react-native-device-info --save

  1. Run with react-native run-ios
Screen Shot 2019-08-08 at 3 36 01 PM

Describe what you expected to happen:

  1. I would expect the app to start normally.
  2. To be coherent, I would have expected react-native-device-info to be installed in ./node_modules/@react-native-community/react-native-device-info. Rather it’s installed in ./node_modules/react-native-device-info

Reproducible sample code

The app created by init is sufficient after importing DeviceInfo in App.js.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
patrice4githubcommented, Aug 9, 2019

Thanks for the feedback! Cheers! PR? Not sure what that is…

-Patrice

On Thu, Aug 8, 2019 at 5:57 PM Mike Hardy notifications@github.com wrote:

@patrice4github https://github.com/patrice4github Cocoapods is now the default for RN60, everything RN60 requires a pod install, so it’s just assumed now - any time you do anything with RN60 that touches native code, you’ll have to pod install after. At the same time, even though it should be assumed if you want to propose a PR to the README that makes it clear, it might save future people time and I’d be willing to merge

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-device-info/issues/747?email_source=notifications&email_token=AANFW7SO7TCGV54HENSENRTQDSJDDA5CNFSM4IKN4E2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD35AOQY#issuecomment-519702339, or mute the thread https://github.com/notifications/unsubscribe-auth/AANFW7SVU7HH5JQV3YUKZC3QDSJDDANCNFSM4IKN4E2A .

0reactions
annieweycommented, Oct 3, 2019

@mikehardy You’re right. I’ve missed out some part during the RN 0.60 upgrading process. Thanks for pointing that out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NativeModule.RNDeviceInfo is null - Stack Overflow
I'm trying to use react-native-device-info (8.7.0) to get some device information on an Android React Native application (RN version 0.60.5) ...
Read more >
NativeModule.RNDeviceInfo is NULL - Expo Development Tools
I am trying to use 'react-native-device-info' libary, but I take this error: ... RNDeviceInfo is NULL on RN 0.59.8 (Expo SDK 34).
Read more >
react-native-device-info - UNPKG
20, throw new Error(`@react-native-community/react-native-device-info: NativeModule.RNDeviceInfo is null. To fix this issue try these steps:.
Read more >
react-native-device-info - npm
Method Return Type iOS Android Windows Web getAndroidId() Promise ❌ ✓ ❌ ❌ getApiLevel() Promise ❌ ✓ ❌ ❌ getApplicationName() string ✓ ✓ ✓ ❌
Read more >
Upgrading a React Native app from 0.60 to 0.65 - YouTube
Jamon attempts to upgrade a React Native app from 0.60 to 0.65 with ... mixed results. -- Watch live at https://www.twitch.tv/jamonholmgren.
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