Skip to content
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

java.lang.Double.doubleValue()' on a null object reference #19413

Closed
tapz opened this issue May 23, 2018 · 31 comments
Closed

java.lang.Double.doubleValue()' on a null object reference #19413

tapz opened this issue May 23, 2018 · 31 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.

Comments

@tapz
Copy link

tapz commented May 23, 2018

Received this to Crashlytics. RN does not provide any information, which would help to find the cause of this (unless it is actually a bug in RN).

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference
       at com.facebook.react.bridge.ReadableNativeArray.getDouble(ReadableNativeArray.java:114)
       at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:64)
       at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:60)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:359)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:789)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
       at android.os.Looper.loop(Looper.java:164)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
       at java.lang.Thread.run(Thread.java:764)
@react-native-bot
Copy link
Collaborator

It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out?

If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label.

@react-native-bot react-native-bot added 📋No Template Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. labels May 23, 2018
@react-native-bot
Copy link
Collaborator

Please use Stack Overflow for this type of question.

@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label May 23, 2018
@tasneembohra
Copy link

I am also facing this issue in production.

@tapz
Copy link
Author

tapz commented May 29, 2018

This is a React Native issue. It has something to do with the bridge, state changes and updating the UI. I changed the order in which I set the state an call native methods and the error does not occur anymore.

@iorikingdom
Copy link

+1

8 similar comments
@jferas
Copy link

jferas commented Jun 19, 2018

+1

@pilot4u
Copy link

pilot4u commented Jun 22, 2018

+1

@alejandrosanabriav
Copy link

+1

@sporteman
Copy link

+1

@C0dekid
Copy link

C0dekid commented Jul 6, 2018

+1

@witalobenicio
Copy link

+1

@taufiqrohman
Copy link

+1

@steven-haddix
Copy link

+1

@seanmorton
Copy link

seanmorton commented Jul 17, 2018

+1. @tapz, to clarify are you referring to redux state? Could you supply more specifics on your fix please?

@seanmorton
Copy link

Nevermind, seems to be more discussion on this in #19423. Would be awesome to understand more details of your fix there.

@tapz
Copy link
Author

tapz commented Jul 18, 2018

@seanmorton Obsiously, I'm referring to React Component (local) state, which makes the component to update.

@seanmorton
Copy link

Thanks for the clarification!

@JiaYuZ
Copy link

JiaYuZ commented Jul 31, 2018

I "fixed" the problem by making sure status bar color in ReactNative same as the status bar color in Android theme

@nes123
Copy link

nes123 commented Sep 1, 2018

+1

@DiegoOpenheimer
Copy link

This error happened to me when I used a bridge in the wrong way, causing the error, for example, to use the toastAndroid.show ('....') without passing the time

@serhiipalash
Copy link

I have this error when I pass NaN to animatedScale.setValue(newScale). If anyone else is experiencing this issue during animation handling, check your calculation so that new value always should be a real number.

@nes123
Copy link

nes123 commented Oct 18, 2018

guys how are you debugging such crashes? is there a way to catch native errors?

@apotox
Copy link

apotox commented Nov 29, 2018

the second param must be a Double or Int , not a String
try ToastExample.show('Awesome',300);
it worked for me

@hoseineghbal
Copy link

i solved it in react native with redux and problem was related to style of store new state for redux ...

for this bug you must first get instance of state in redux reducer like this ::

const newState = state;

and then change and return it::

newState.check = true;

return newState;

bug did fix for me after 24 hours trying ...

@reisdev
Copy link

reisdev commented Dec 17, 2018

This error happened to me when I used a bridge in the wrong way, causing the error, for example, to use the toastAndroid.show ('....') without passing the time

That was my mistake, I forgot the duration for the ToastAndroid.show()

@ithustle
Copy link

ithustle commented Jan 28, 2019

I'm facing this error on android, after upgrade to RN 0.58.2 ... Any help?

@abendi
Copy link

abendi commented Jan 28, 2019

I'm facing this error on android, after upgrade to RN 0.58.2 ... Any help?

For me the issue was using <StatusBar barStyle={"dark-content"} animated={true} /> in render method. It seems that now you need to provide backgroundColor and hidden props as well or it will crash.
But using imperative API it works as previously:

componentDidMount() {
  StatusBar.setBarStyle(...);
}

I also raised an issue (#23193).

@ithustle
Copy link

ithustle commented Jan 28, 2019

@abendi, make sense. Matter fact, I'm using <StatusBar .. /> too. I'll double check it.. The community are fixing it. They will release 0.58.3 less than a couple hours.

@OctoD
Copy link

OctoD commented Apr 1, 2019

Also facing a similar one to this using Axios, did somebody fixed or found a work around for this?

[edit]

It was raised by axios, but giving it a timeout (like 500) in it's own config fixed the issue. Weird.

@gustavo-franco-iw
Copy link

+1

@aweffr
Copy link

aweffr commented May 22, 2019

My Envirment:
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz
Memory: 5.13 GB / 15.94 GB
Binaries:
Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.1.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338

I have got this problem too!
When this error happend, I tried rollbacking my codebase to the production branch, but the compiled debug version still got this problem!

After half-day debugging, I thoungt that when the first time this bug occur, I ran react-native run-android and the logs said that gradle was downloading some files but stucked! (Network issue?) Then I ctrl-C to run again react-native run-android, this problem happened!

So I delete all the cache files/dirs in home/.gradle/cache (On windows, it's %USERPROFILE%.gradle\cache) and run react-native run-android again, this bug gone away!

Good Luck!

@facebook facebook locked as resolved and limited conversation to collaborators May 23, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label May 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests