My App at expo is developed with React Native and Apollo Client and connects to a graphql server using useQuery to bring data from a mongodb database, in development it works correctly, but when I generate the apk and install it on any cell phone that has Android 11 or higher does not work, however it works correctly on Android 7.

This is my code to bring the information:

const { loading, error, data } = useQuery(queries.query.getParametro, {
  variables: {},
});

let mensajeError = ""

if (error) {
  if (error.message) {
    mensajeError = "Error: " + error.message
  } else {
    mensajeError = error
  }
} else {
  mensajeError = "NO hay error"
}

In Android 7 there is no error and it enters by messageError = "There is NO error" and data remains with the information correctly. On Android 11 or higher if there is an error and enter by messageError = "Error: " + error.message error.message returns Network request failed which, consulting ChatGPT, tells me that there is a problem with the device's network connection or that the request made from the application could not connect correctly to the network Although it is not necessary, in app.json I added the following permissions:

"android": {
  "permissions": ["INTERNET", "ACCESS_NETWORK_STATE", "ACCESS_WIFI_STATE"],
},

but it didn't work either and I really don't know what else to do.

I think that in development the app is ok, but that there is something to configure on Android 11 or higher that allows solving the error received Network request failed (indicates that there is a problem with the device's network connection or that the request made from the application could not connect correctly to the network), taking into account that in development and on Android 7 everything works correctly.

0

There are 0 best solutions below