New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined is not object (evaluating 'RNDeviceInfo.deviceId') #52
Comments
The same story. Android 6.0. |
That error happens when the java module is not being loaded somehow. Make sure that you've done ALL of https://github.com/rebeccahughes/react-native-device-info#installation-android. After doing the above, do a "Clean" then "Run". |
Same issue here for iOS
I installed it via |
I fixed my issue by relinking the native dependency. It was improperly linked (or its linking wasn't properly checked into .pbxproj) so I suppose it was undefined at runtime. Although on closer look, it seems my issue is not what is reported here. |
I've got this error after install the module and use it in my code, when I try to configure "react-native-device-info" from "pod install". A version of React (0.11.0) is installed and duplicate symbols:
If I try to configure manually I've got this error:
|
My solution was to downgrade react and react-native:
Good luck! |
Thanks @manupytwn I will try it very soon. ( I am facing another problem also I have added the "react-native-device-info" in packages but not used for the above error, In my simulator the build is working fine but if someone clone the project & wants to run the project in simulator it caused error but if I uninstall the "react-native-device-info" package and remove the added portion "MainActivity.java & AndroidManifest.xml" it works fine. Is there any reason for that? Do you have any idea? ) |
Exactly the same problem. Ran it last night it was okay. This morning this error magically appeared. |
First I got this error on the red screen, but after I rebuilt all again, my android app started to force-close. to make matters worse... |
Hi, I get the same error on Android, when running "react-native run-android" on a device: MainApplication.java:41: error: cannot find symbol Is there any solution imminent? We cannot release without this unfortunately (because it works on iOS but not on Android...) |
Anyone found a solution? I am getting the same error on Android and I have to upload the application ASAP. |
I had the same issue after installing the module with npm. It seems like the problem was that i didn't link the module https://github.com/rebeccahughes/react-native-device-info/#automatically-link . I solved the problem running |
As @jorge8989 said, after running |
@breadadams I did that but still getting the same error I am using RN 0.34 and it run perfectly fine on iOS only android have this issue. |
Hmm, that's weird @itcurves. I'd only tested on iOS so far, but just ran on android (simulator) & working fine there too. Maybe it's an incompatibility? The app I'm testing on is pretty barebones at the mo' - just default react-native components & some firebase connections. |
Yes @breadadams it is. Look at this I just try to link again: rnpm-install info Android module react-native-device-info is already linked but still same error: Cannot read property 'uniqueId' of undefined |
Had the same issue (runnig on ios real device) and re-linking solved that for me, why "relinking"? cause apparently my first trying to link it manually effected so I ran: react-native unlink react-native-device-info and afterwards react-native link react-native-device-info |
I had the same problem.The solve way I use is: |
After Linking I got this:-
But still error was coming. So I cleaned the project and build it again. Works perfectly after that |
I have a similar error on android 4.4 device (works ok in emulator):
Have double checked https://github.com/rebeccahughes/react-native-device-info#installation-android Have run When I run Any ideas ? |
I've got the same issue. @ThunderDev1 solution didn't work for me. Any other suggestions? |
I've tried all the suggestions above and I'm still getting the same error. Does everyone still have this issue after it was first reported almost a year ago? Nobody found the cause of the bug? |
Developing in Expo and none of the previous solutions have helped. Any suggestions? |
Same problems here also with Expo.... |
did you eject from Expo? So you have an ios/android project? |
make sure your android file
|
I am using Expo and none of the above solutions worked for me. I am using Expo to create a standalone iOS app |
@Lawrence23 try
|
@tronin Tried that. Didn't work |
react-native link OR react-native link react-native-device-info. Now run it. This fixed in my case. |
@jiteshwadia Are you using Expo? It seems like that may be the issue. I'm not able to link it using Expo either. |
@bencodezen , No, I am not using Expo |
@kmakihara @Lawrence23 @encorex For Expo users, it seems like this library isn't compatible as far as I can tell. The workaround for this is to use Expo Constants https://docs.expo.io/versions/latest/sdk/constants.html. Hope this helps future Expo users trying to use this library! |
Same here, I just createad a fresh new project and then tried to use it on iOS emulator and failed with this message.. Is this a particular OS problem or is something with the library? |
I got it working after linking it again(for some reason you need to do 2x, |
For those facing this on iOS, the complete steps for me were to: Shut down packager It then worked no problem. Really not sure what the actual issue was, my guess is that the package was not properly linked. (I always use |
Thanks @bencodezen for the workaround, my code snippet for those trying to use react-native-device-info with Expo
|
In my case libRNDeviceInfo.a |
Closing this old issue which became a melting pot of ios/android build issues.. |
@bencodezen Saved me, thank you very much! |
For anyone still having this issue even after following the manual linking steps.
In case you don't have
|
Commenting on @bakedbird fix. I had the problem where the Main Application never created a new instance for RNDdeviceInfo(). I fixed it by adding it in RNDeviceInfo into the following code in MainActivity. Please note I changed my java file to use kotlin and dont forget to
|
thanks chiragpurohit71085 your solution worked for me |
This issue is popular, but it is always an installation/configuration issue. There is a clean example in the repository built following the instructions and working well. If you can reproduce your problem in the example, open a new issue. If not, then study the example again to see how to integrate things and make sure you followed the instructions... |
Ho man!! Wasted 3 days on this!! |
If anyone is still having issues with this I found that I had this issue when upgrading from |
@CoryWritesCode if you haven't seen https://github.com/react-native-community/react-native-device-info/wiki/V2-to-V3-Migration-Guide you should check it out - there were quite a few moves, but all documented with the from what -> to what |
@CoryWritesCode I would have never noticed this thank you |
@digitaluniverse most of the API name changes are similarly subtle re-capitalizations - please look at the inventory on the v2->v3 page, I would hate for anyone else to waste any more time than needed |
@mikehardy Thanks for the link! I had not seen that at all. Might be good to have that linked on the README. |
@CoryWritesCode oh dang - I thought I did? It is definitely in the changelog, but you're right. The more linkage the better - the v3 release is breaking but it is not supposed to suck as an upgrade :-) |
Related to #52 - came up in the comments it could be linked more prominently
var DeviceInfo = require('react-native-device-info');
console.log(DeviceInfo.getDeviceId());
Android 5.1
The text was updated successfully, but these errors were encountered: