-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Error: attempt to invoke virtual method boolean on a null object reference react native #1403
Comments
I have the same issue with my react native project, it's working well on iOS but I get this error with android. versions: The error comes during the connection: Still trying to understand. |
me too facing same issue after upgrading my libs, all the app works fine, but socket throw this same error: versions: |
I'm new to react-native and I'm also experiencing this issue, is there a known work around? |
I downgraded to version 2.3.1, that fixes the issue. yarn add [email protected] |
Hi everyone. I could indeed reproduce. Is there a way we can find the line that is triggering this error? |
The undefined value breaks React Native on Android with a rather cryptic error message: ``` Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue() on a null object reference ``` This bug was introduced by [1]. [1]: 5f47a50 Related: socketio/socket.io-client#1403
@darrachequesne I read your commit and added |
@Mohamed-Rajab-2112 you are right, explicitly setting It should be fixed by I updated the React Native example with Socket.IO v3 here: https://github.com/socketio/socket.io/tree/master/examples/react-native |
I'm having the same issue but only for my RN project in Typescript. My other RN project written in JS doesn't have this issue. And |
Yes you are right, for typescript, you may try to extend the socket config and add |
Adding the
but on client side, connected is false.
I tried downgrading to 2.3.1 but cannot start my RN project's metro server because of module I opened an issue in engine.io-client's repo. |
@darrachequesne so to test it, should I |
Okay, i will give it a check later tonight :) |
Temporary fix at the moment, for me at least is downgrading socket.io-client to 2.3.1. However, engine.io-client raised the mentioned error because its' looking for the Now I can connect to my server. Gonna stick with 2.3.1 for now. |
@Rc85 Guys just updated the package few hours ago, try the new version i think it solved the issue, good luck! |
This should be fixed by socketio/engine.io-client@ccb99e3. Please run If you use Expo, you may have to clear its cache with |
Note: for support questions, please use one of these channels: stackoverflow or slack
For bug reports and feature requests for the Swift client, please open an issue there.
For bug reports and feature requests for the Java client, please open an issue there.
You want to:
Current behaviour
What is actually happening?
After upgrade from 2.3.0 to 3.0.1 getting error in react-native
Steps to reproduce (if the current behaviour is a bug)
-Create new react-native project.
-Install socket.io-client.
-Use it in your code.
Note: the best way (and by that we mean the only way) to get a quick answer is to provide a failing test case by forking the following fiddle.
Expected behaviour
What is expected?
To work properly.
Setup
OS: Android
browser:
socket.io version: 3.0.1
Other information (e.g. stacktraces, related issues, suggestions how to fix)
The text was updated successfully, but these errors were encountered: