question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempt to Invoke Interface Method 'boolean com.facebook.react.brige.ReadableMap.hasKey(java.lang.String)' on a null object reference

See original GitHub issue

My code works fine on iOS, the trouble begins in Android. Whatever I do, I face this error: screen shot 2017-11-16 at 17 37 08

This is how I invoke image picker:

uploadFile() {
		ImagePicker.launchImageLibrary(null, (response)  => {
			console.log('Response = ', response);

Solution

You shouldn’t set option to null as it will cause the error. You better use an empty object {} instead. Adding some robustness can help other developers not to encounter this error.

react-native-cli: 2.0.1 react-native: 0.46.3 react-native-image-picker 0.26.7 Android MacOS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:22
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
griosbcommented, May 6, 2020

same problem, please image

2reactions
trinhvanvinhcommented, Mar 23, 2018

i have bug the same. how to fix ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attemp to invoke interface method java.lang.String com ...
I faced the same error. The solution is to do a 'Fetch replacement' as the official documentation explains: Since we are not implementing ......
Read more >
Attempt to invoke interface method ''android.view.MenuItem ...
MenuItem.setVisible(boolean)'' on a null object reference at org.mozilla.gecko.home.HomeFragment.onCreateContextMenu(HomeFragment.java).
Read more >
com.facebook.react.bridge.ReadableMap.getString java code ...
Best Java code snippets using com.facebook.react.bridge.ReadableMap. ... getBoolean(...) return map.getBoolean(key); case String: { String value = map.
Read more >
Example usage for com.facebook.react.bridge ReadableMap ...
String key = iterator.nextKey(); switch (readableMap.getType(key)) { case Null: object. · Boolean: object.put(key, readableMap. · Number: object.put(key, ...
Read more >
Attempt To Invoke Interface Method Java.Lang.String Com ...
Attempt to Invoke Interface Method 'boolean com.facebook.react.brige.ReadableMap.hasKeyjava.lang.String' on a null object reference #730. Null reference errors ...
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