@react-native-community/netinfo: NativeModule.RNCNetInfo is null on some android devices only

See original GitHub issue

Environment

System:
    OS: macOS 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 38.43 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.11.0 - ~/.nvm/versions/node/v10.11.0/bin/node
    Yarn: 1.12.3 - ~/.nvm/versions/node/v10.11.0/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.11.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 26, 28, 29
      Build Tools: 28.0.3
      System Images: android-29 | Intel x86 Atom_64, 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: 10.2/10E125 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: ^0.60.3 => 0.60.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native: 0.59.1

Platforms

This occur on some android devices (android 6,7,8,9) No error found on iOS, Some other android devices still work without this error.

Versions

Description

The error I’ve got from Fabric:

Fatal Exception: com.facebook.react.common.JavascriptException: @react-native-community/netinfo: NativeModule.RNCNetInfo is null. To fix this issue try these steps:

• Run `react-native link @react-native-community/netinfo` in the project root.
• Rebuild and re-run the app.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
• Check that the library was linked correctly when you used the link command by running through the manual installation instructions in the README.
* If you are getting this error while unit testing you need to mock the native module. Follow the guide in the README.

If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-netinfo, stack:
<unknown>@498:410
v@2:1474
<unknown>@497:184
v@2:1474
<unknown>@496:171
v@2:1474
<unknown>@493:431
v@2:1474
<unknown>@492:144
v@2:1474
<unknown>@488:156
v@2:1474
<unknown>@341:342
v@2:1474
<unknown>@340:219
v@2:1474
<unknown>@6:58
v@2:1474
d@2:876
global code@1421:4

       at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError + 54(ExceptionsManagerModule.java:54)
       at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException + 38(ExceptionsManagerModule.java:38)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke + 372(JavaMethodWrapper.java:372)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke + 158(JavaModuleWrapper.java:158)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback + 873(Handler.java:873)
       at android.os.Handler.dispatchMessage + 99(Handler.java:99)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage + 29(MessageQueueThreadHandler.java:29)
       at android.os.Looper.loop + 214(Looper.java:214)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run + 232(MessageQueueThreadImpl.java:232)
       at java.lang.Thread.run + 764(Thread.java:764)

Reproducible Demo

Can not create the minimal demo because our app is on production

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:25 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
heroiccommented, Oct 10, 2019

Ever since upgrading react native to 0.61.2 I am seeing this error on my app as well. Can’t say what’s going on.

2reactions
JonathanHolveycommented, Jul 3, 2020

I ran into this issue when upgrading from React native 0.61 to 0.62. I followed the upgrade helper and updated all relevant sections of the config, but the issue remained.

In the end, I resorted to react-native link @react-native-community/netinfo, but the link it created needed modifying before it would work. I had to change a dependency line in android/app/build.gradle from:

implementation project(':react-native-community-netinfo')

to:

implementation project(':@react-native-community_netinfo')
Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-community/netinfo: NativeModule.RNCNetInfo is ...
RNCNetInfo is null on some android devices only #221 ... Run `react-native link @react-native-community/netinfo` in the project root.
Read more >
react-native-community/netinfo: NativeModule.RNCNetInfo is ...
After successful linking when run my project i got error @react-native-community/netinfo: NativeModule.RNCNetInfo is null... I also tried with ...
Read more >
@react-native-community/netinfo - npm
React Native Network Info API for Android, iOS, macOS, Windows & Web. It allows you to get information on: Connection type; Connection quality ......
Read more >
react-native-community/netinfo/README.md - UNPKG
If unknown defaults to `null` |. 251, | `isWifiEnabled` | `boolean` | *(Android only)* Whether the device's WiFi is ON or OFF. |....
Read more >
@react-native-community/netinfo | Yarn - Package Manager
@react-native-community/netinfo. Actions Supports Android, iOS, macOS, Windows and Web MIT License Lean Core Extracted. React Native Network Info API for ...
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