React Native uses Fetch API to request the network to report Network request failed on Android.

React Native uses the Fetch API request network to report that the Network request failed,
request is https on Android. The interface is normal, but this happens on react-native projects. Does anyone know what"s going on?
or can it be accessed by domain name only if there is no IP, in the interface address in react-native?

    fetch("https://192.168.199.188:18300/**********", {
      method: "get",
      headers: {
        "Content-Type": "application/json",
        "Accept": "application/json",
      },

    })
        .then(resp => resp.json())
        .then(data => {
            console.log(data)

        })


We encountered the same problem in RN version 0.59.2. Ios can android but not android. The final solution is to debug with Android phone usb, and then do not report such an error if you are not connected to wifi and connect to your own 4G network. The interface uses online http, instead of fetch to transmit formData data, and the simulator still runs like this. So at present, we can only use the real machine to debug the 4G network, which is very embarrassing. I don't know what the Android side has to do with the network environment.


is it a cross-domain problem? Use Proxy to proxy the interface.


without posting your code.
I suggest you use axios , which is a more mature module.
Chinese introduction: axios


grab the package and take a look at the error code of the network request


I encountered this mistake before, and then I saw that I uploaded the wrong picture and gave the wrong picture path to the wrong ios.


I also encountered this mistake a few days ago. The requested server address is not available in the local environment and must be online. This is an android problem. Ios is normal


has it been solved now? I also encountered this problem. I can get the interface written by myself with express and the interface developed on the Internet, and I will report an error with my own interface.
even if I try axios,fetch, it won't work.


I have the same problem. How do you solve


the API interface I built on this machine, I can't use localhost or 127.0.0.1 for Android. Just change it to the local IPV4 address.


have you solved the same problem?

Menu