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 virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

See original GitHub issue

I am running the Android application with react-native run-android. The application crashing at the entry with the following error

Attempt to invoke virtual method ‘boolean java.lang.String.equals(java.lang.Object)’ on a null object reference

Environment

Environment: OS: Windows 10 Node: 6.10.2 Yarn: 1.5.1 npm: 3.10.10 Watchman: Not Found Xcode: N/A Android Studio: Not Found

The machine does have Android Studio and Android SDK.

Packages: (wanted => installed) react: ^16.3.0-alpha.1 => 16.3.0-alpha.2 react-native: 0.54.2 => 0.54.2

Expected Behavior

The application should open normally

Actual Behavior

The application is crashing with the following errors. screenshot_20180315-193330

Steps to Reproduce

As this is a private project cannot give the code and steps to reproduce.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
danihodoviccommented, Apr 19, 2018

I’ve ran into the same issue. The error message originates from

https://github.com/facebook/react-native/blob/e636eb60d7c8cff3a73183e02d9d457d32a6ec53/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java#L81-L82

On line 81 the developer tries to extract the scheme (http/https) the request is using, but the method uri.getScheme() is returning null. That means your request has no scheme. Line 82 attempts to call a virtual method which doesn’t exist for the value null.

Add a scheme to your request and the problem should go away.

We should submit a PR to provide a clearer error message when the request doesn’t have a scheme.

6reactions
bchr28commented, Mar 20, 2018
componentDidMount() {
    this.getBanner();
  }
  
  getBanner = () => {
    fetch(API_URL_BANNER, {
      method: 'POST',
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json'
      },
      body : JSON.stringify(
        {server_key: SERVER_KEY, client_key: CLIENT_KEY}),
      })
        .then((response) => response.json()).then((responseJson) => {
          responseJson = responseJson['data'];
          console.log(responseJson);
        }).catch((error) => {
      console.error(error);
    });
  }

I got same issue here, error show where I get data from API, and in log show

ReactNative: CatalystInstanceImpl.destroy() start ReactNative: CatalystInstanceImpl.destroy() end

FYI I use “react”: “16.3.0-alpha.1”, “react-native”: “0.54.2”,

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException: Attempt to invoke virtual method ...
NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference ...
Read more >
Attempt to invoke virtual method 'boolean java.lang.String ...
NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference #4618.
Read more >
Attempt to invoke virtual method 'boolean java.lang ... - YouTube
... Attempt to invoke virtual method ' boolean java. lang. String.equalsIgnoreCase( java. lang. String )' on a null object reference [ B...
Read more >
Attempt to invoke virtual method ''boolean java.lang.String ...
NullPointerException: Attempt to invoke virtual method ''boolean java.lang.String.equals(java.lang.Object)'' on a null object reference at org.mozilla.gecko.
Read more >
Error from Companion: Attempt to invoke virtual method 'java ...
It said, "Error from Companion: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference" ...
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