Giter VIP home page Giter VIP logo

Comments (40)

sagargulati avatar sagargulati commented on September 27, 2024 12

Any solution with auto-linking on react-native 0.61.1? The same issue coming.

from react-native-netinfo.

ryekerjh avatar ryekerjh commented on September 27, 2024 3

I installed the most recent version (2.0.3) and went back and installed 2.0.2 (npm install --save @react-native-community/[email protected]) and I am getting the same error. Is there anything I may be missing?

from react-native-netinfo.

guptayash avatar guptayash commented on September 27, 2024 3

@ryekerjh Hey!
I have installed version 2.0.2 and linked it again using react-native link @react-native-community/netinfo that linked it successfully but didn't work while I was building the app from xcode.
So I manually dragged RNCNetInfo.xcodeproj (which is located at node_modules/@react-native-community/netinfo/ios/RNCNetInfo.xcodeproj) into root of xcode project. And after that go to build phase in xcode and click Link binary with libraries and add libRNCNetInfo.a there. That worked for me

from react-native-netinfo.

defcon8 avatar defcon8 commented on September 27, 2024 2

Same problem here with react-native 0.61.5. Unable to use this module with auto-linking.

from react-native-netinfo.

mikehardy avatar mikehardy commented on September 27, 2024 2

Podfile would be more useful, I bet it's missing something like the pair of https://github.com/facebook/react-native/blob/master/template/ios/Podfile#L2 and https://github.com/facebook/react-native/blob/master/template/ios/Podfile#L78

from react-native-netinfo.

emersonhsieh avatar emersonhsieh commented on September 27, 2024 2

@emersonhsieh read that second link I sent very carefully https://github.com/facebook/react-native/blob/master/template/ios/Podfile#L78

It does not contain the characters 'unimodules'

Got it, I'll add those lines manually to the Podfile since Expo did not generate them on ejection. Thank you so much!

from react-native-netinfo.

rahul-spericorn avatar rahul-spericorn commented on September 27, 2024 2

I am using
"react-native": "0.62.2",
"@react-native-community/netinfo": "^5.9.2",
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip

I am getting this error "NativeModule.RNCNetInfo is null" in android

I tried with manual linking no use.

Anyone, please help

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024 1

👋 Thanks for reporting this. I have an idea what this is and will work to have a fix out by tomorrow

from react-native-netinfo.

react-native-community-bot avatar react-native-community-bot commented on September 27, 2024 1

🎉 This issue has been resolved in version 2.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

from react-native-netinfo.

mattvaldez avatar mattvaldez commented on September 27, 2024 1

@matt-oakes I just installed 2.0.2 and it works, thanks for the fast fix!

from react-native-netinfo.

dongcaiying avatar dongcaiying commented on September 27, 2024 1

@guptayash Also worked for me. Libraries--RCTNetInfo.xcodeproj--Products--libRNCNetInfo.a drag to targets--Build Phases --Link Binary With Libraries.

from react-native-netinfo.

SourceCipher avatar SourceCipher commented on September 27, 2024 1

@matt-oakes Oh I did not see the manual, thanks, that was the problem. Havent linked properly!

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024 1

@ngoctan95 This is working if you have the library linked correctly. If you search for RNCNetInfo in the issues there are already lots of discussions for the different scenarios where linking was not performed correctly. It's 99% certain that your issue is one of those. Take a look through them and if it really isn't one of those, open a new issue with as much information as you can, including why it's not any of the previously mentioned issues.

https://github.com/react-native-community/react-native-netinfo/issues?utf8=✓&q=RNCNetInfo

from react-native-netinfo.

 avatar commented on September 27, 2024 1

Rebuilding the app again solved the issue for me.

Uninstall the app first, run the command "cd android && gradlew clean && cd.." then run "react-native run-android".

from react-native-netinfo.

LucaKIN avatar LucaKIN commented on September 27, 2024 1

@sagargulati

I recommend unlink everything that you do manually related this dependency and add the following line in your Podfile.
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

Then pod install and it should work.

from react-native-netinfo.

mikehardy avatar mikehardy commented on September 27, 2024 1

npx react-native-clean-project clean-project-auto

this happens all the time for react-native-device-info (I maintain there) and that command above frequently clears things up (except when it doesn't, but doesn't hurt to try)

the module definitely works with auto-linking.

from react-native-netinfo.

ChathuraPrabhash avatar ChathuraPrabhash commented on September 27, 2024 1

This issue still has I'm testing on android 9.

from react-native-netinfo.

bitkidd avatar bitkidd commented on September 27, 2024

Yeap, 2.0.1 has this bug, 2.0.0 works fine.

from react-native-netinfo.

mattvaldez avatar mattvaldez commented on September 27, 2024

Thanks for fixing!

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024

@mattvaldez No problem! Sorry for the issues. It's because I changed the way the module was packaged and didn't test it fully. I might add a step to CircleCI to catch issues like this, but it's not likely to happen again now it's all set up.

Let me know if you have any other issues.

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024

@ryekerjh Have you rebuilt the native code and rerun the app? You also might need to check that it is liked correctly by running the link command again.

from react-native-netinfo.

ryekerjh avatar ryekerjh commented on September 27, 2024

@matt-oakes Thanks for the quick response! I did rebuild (shut down the server, wiped the emulator, closed the terminal and ran react-native run-ios from scratch.) I also ran the link command again, but same error.

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024

@ryekerjh can you open a new issue with the details for a bug report. It's likely that linking is the issue. Can you also let me know in the issue if you're using Cocoapods and the contents of the Podfile and Podfile.lock

from react-native-netinfo.

guptayash avatar guptayash commented on September 27, 2024

Same issue with me. Unable to solve it with new update(@2.0.2)

from react-native-netinfo.

ryekerjh avatar ryekerjh commented on September 27, 2024

@guptayash after installing and linking, are you trying to clean and build the project in XCode? If so, are you getting any errors?

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024

@guptayash In that case, the link command was actually failing. You either have a non-standard project structure that the CLI can't read correctly or there is a bug in the CLI link command. Either way, it's unrelated to this library.

from react-native-netinfo.

SourceCipher avatar SourceCipher commented on September 27, 2024

2.0.10 still has the bug. Linking didn't help at all

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024

@SourceCipher Can you send over:

  • Contents of your .gradle files
  • Contents of your MainApplication.java
  • Screenshot of your iOS linked libraries

If you are running the react-native link command, it's likely that it's only partly completed. The most likely place that it's failed in in adding the module to the android MainApplication.java. Double check that and follow the instructions for manual linking to double check.

from react-native-netinfo.

SourceCipher avatar SourceCipher commented on September 27, 2024

@matt-oakes that was a quick reply! I am not using iOS. Android dont seem to have manual linking guide nor I have seen on the npm docs. From what I can see is that MainApplication was not changed at all after linking so it must be the case that it was not added to the MainApplication

from react-native-netinfo.

matt-oakes avatar matt-oakes commented on September 27, 2024

@SourceCipher Manual linking guides for both platforms are in the README. Search for "Manually link the library on Android" and click the arrow to expand the instructions. If MainApplication was not changed, then that is your issue.

from react-native-netinfo.

ngoctan95 avatar ngoctan95 commented on September 27, 2024

same issue. @matt-oakes . ios and android manual linking. but not work in release. crash app. it is maybe critical bug,

from react-native-netinfo.

sagargulati avatar sagargulati commented on September 27, 2024

@LucaKIN: I'm not building for iOS nor I'm on Mac

from react-native-netinfo.

emersonhsieh avatar emersonhsieh commented on September 27, 2024

Unfortunately, I had to link the package manually to get it to work on iOS as well. I have a freshly ejected Expo 36 (React Native 0.61.4) app with the Bare workflow, and I tried the solution above to no avail.

Here is my system info; hopefully this helps pin down the issue.

info Fetching system and libraries information...
System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
    Memory: 129.51 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    npm: 6.13.2 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 26, 27, 28, 29
      Build Tools: 26.0.2, 28.0.3, 29.0.1
      System Images: android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    react: ~16.9.0 => 16.9.0 
    react-native: ~0.61.4 => 0.61.4 
  npmGlobalPackages:
    react-native-cli: 2.0.1

from react-native-netinfo.

emersonhsieh avatar emersonhsieh commented on September 27, 2024

@mikehardy you were right, the line require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' was missing from my Podfile. use_unimodules! was in the Podfile though.

I tried adding the missing line to the Podfile, cleared node_modules and ran npm install and pod install, but my Podfile didn't change and the NetInfo pod still didn't install without linking manually. Should Podfile be modified automatically after installing the NetInfo npm package?

Here is my original Podfile for reference:

platform :ios, '10.0'

require_relative '../node_modules/react-native-unimodules/cocoapods'

target 'Waves' do

  rnPrefix = "../node_modules/react-native"
  
  # React Native and its dependencies
  pod 'FBLazyVector', :path => "#{rnPrefix}/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "#{rnPrefix}/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "#{rnPrefix}/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "#{rnPrefix}/Libraries/TypeSafety"
  pod 'React', :path => "#{rnPrefix}/"
  pod 'React-Core', :path => "#{rnPrefix}/"
  pod 'React-CoreModules', :path => "#{rnPrefix}/React/CoreModules"
  pod 'React-RCTActionSheet', :path => "#{rnPrefix}/Libraries/ActionSheetIOS"
  pod 'React-RCTAnimation', :path => "#{rnPrefix}/Libraries/NativeAnimation"
  pod 'React-RCTBlob', :path => "#{rnPrefix}/Libraries/Blob"
  pod 'React-RCTImage', :path => "#{rnPrefix}/Libraries/Image"
  pod 'React-RCTLinking', :path => "#{rnPrefix}/Libraries/LinkingIOS"
  pod 'React-RCTNetwork', :path => "#{rnPrefix}/Libraries/Network"
  pod 'React-RCTSettings', :path => "#{rnPrefix}/Libraries/Settings"
  pod 'React-RCTText', :path => "#{rnPrefix}/Libraries/Text"
  pod 'React-RCTVibration', :path => "#{rnPrefix}/Libraries/Vibration"
  pod 'React-Core/RCTWebSocket', :path => "#{rnPrefix}/"
  pod 'React-Core/DevSupport', :path => "#{rnPrefix}/"
  pod 'React-cxxreact', :path => "#{rnPrefix}/ReactCommon/cxxreact"
  pod 'React-jsi', :path => "#{rnPrefix}/ReactCommon/jsi"
  pod 'React-jsiexecutor', :path => "#{rnPrefix}/ReactCommon/jsiexecutor"
  pod 'React-jsinspector', :path => "#{rnPrefix}/ReactCommon/jsinspector"
  pod 'ReactCommon/jscallinvoker', :path => "#{rnPrefix}/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "#{rnPrefix}/ReactCommon"
  pod 'Yoga', :path => "#{rnPrefix}/ReactCommon/yoga"
  pod 'DoubleConversion', :podspec => "#{rnPrefix}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rnPrefix}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rnPrefix}/third-party-podspecs/Folly.podspec"

  # Other native modules
  pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
  pod 'RNReanimated', :podspec => '../node_modules/react-native-reanimated/RNReanimated.podspec'
  pod 'RNScreens', :path => '../node_modules/react-native-screens'

  # Automatically detect installed unimodules
  use_unimodules!
end

from react-native-netinfo.

mikehardy avatar mikehardy commented on September 27, 2024

@emersonhsieh read that second link I sent very carefully https://github.com/facebook/react-native/blob/master/template/ios/Podfile#L78

It does not contain the characters 'unimodules'

from react-native-netinfo.

im-amir avatar im-amir commented on September 27, 2024

If anyone still facing this problem, I have resolved it by installing the required library by running:
yarn add @react-native-community/netinfo

and it's working now. For:
"react-native": 0.61.2
"react-native-offline": "^5.2.0",

from react-native-netinfo.

kylanhurt avatar kylanhurt commented on September 27, 2024

So, I feel compelled to tell this because it took me an entire day to figure out how to fix the issue. I was getting this error during unit tests and was somehow able to "fix" the issue by changing my component imports, which were being imported via an index file with import { CustomeButton } from '../index' to import CustomeButton from '../CustomeButton' (ie directly from the file, without an intermediate index file).

I don't know how this fixes anything but I figure it may help for others. The good thing is that it appears I only need to change the import syntax in the test files (and not component source files).

from react-native-netinfo.

rahul-spericorn avatar rahul-spericorn commented on September 27, 2024

This issue still has I'm testing on android 9.

have you fixed this issue in android?

from react-native-netinfo.

john-harding avatar john-harding commented on September 27, 2024

ios fix for me:
cd ios
rm Podfile.lock
pod install
cd ..
react-native run-ios

from react-native-netinfo.

mikehardy avatar mikehardy commented on September 27, 2024

For future people: this is ALWAYS an integration issue. You have not integrated the module correctly somehow. Either auto-linking wasn't implemented correctly in a react-native upgrade, or you did not pod install, or you have cached build artifacts (npx react-native-clean-project might help) or a few other things but it is NOT the module's fault. You need to fix your project, then it will work

from react-native-netinfo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.