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.

Getting undefined is not an object: reactNativeDeviceInfo.DeviceInfo.getAPILevel is

See original GitHub issue

Summary

I have recently upgraded to RN: 0.45.1, react-native-device-info: 0.15.1, and whenever I try to query for api level the app crashes with an error.

Version 0.15.1
Affected OS Android
OS Version 8.0.0

Current behavior

Getting this error in sentry:

undefined is not an object (evaluating 'reactNativeDeviceInfo.DeviceInfo.getAPILevel')

This was working in previous version of RN 44.0 and react-native-device-info: 0.13.0

Expected behavior

getAPILevel should give the api level

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
sahil290791commented, Feb 12, 2018

Thanks @machour , sorry I noticed that as it was working in other components of my app, in one particular component i was importing it in an incorrect way:

// incorrect way
import { DeviceInfo } from 'react-native-device-info'`;

// correct way
import DeviceInfo from 'react-native-device-info';
1reaction
machourcommented, Feb 12, 2018

Hi @sahil290791, it seems like you forgot to link the library. Can you try react-native link react-native-device-info?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting undefined is not an object: reactNativeDeviceInfo ...
Summary I have recently upgraded to RN: 0.45.1, react-native-device-info: 0.15.1, and whenever I try to query for api level the app crashes ...
Read more >
undefined is not object (evaluating 'RNDeviceInfo.deviceId')
I am using react-native-device-info library, and it works fine for iOS simulator. But for ...
Read more >
react-native-device-info - npm
If there is no implementation for a platform, then the "default" return values you will receive are "unknown" for string, -1 for number,...
Read more >
Example to Get Device Information in React Native
This is an example to Get Device Information in React Native. To get the device information in React Native will use the react-native-device-info...
Read more >
How to use the react-native-device-info.getDeviceLocale ...
To help you get started, we've selected a few react-native-device-info.getDeviceLocale examples, based on popular ways it is used in public projects.
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