Skip to content

Expo app cannot fetch on some android devices #25610

Closed
@haymouz

Description

@haymouz

Hey guys, I'm currently building a react-native app using expo. It has been running successfully on some android phones for a while not until I tried it on an android phone and it wasn't making network requests. I'm using "FETCH Api" and I clearly don't know why this should be happening.

I don't know if its an android target sdk thing or just a normal configuration thing. I need help

React Native version:

React Native Environment Info:
System:
OS: Windows 7
CPU: (4) x64 Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz
Memory: 1.46 GB / 5.91 GB
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.0.0.0 AI-171.4443003

Important details in the package.json :
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"@babel/core": "^7.0.0",
"@expo/vector-icons": "^9.0.0",
"babel-polyfill": "^6.26.0",
"expr-eval": "^1.2.1",

Steps To Reproduce

  1. expo build:android

Describe what you expected to happen:
I expected the app to success fully make a fetch request

Snack, code example, or link to a repository:

Here's how the fetch request looks like

fetchUsers = () => {
AsyncStorage.getItem('tellerId').then((token) => {
var RMid= token;
this.setState({ loading: true });
fetch(Url+endpoint+RMid,{
headers: {
'cache-control': 'no-cache',
'content-type': 'application/json',
accept: 'application/json' },
})

.then((response) => response.json())
.then((res) => {
  if (res.error) {
    console.log(res.error);
  } 
  else {
    try{
      this.setState({ data: res, loading: false, });
      if (this.state.data.length === 0) { this.setState({ listEmpty: 'Nothing yet' }); }        
    console.log(this.state.data)
    }
    catch (e) {
      alert("Network Problem, Please Try Agian Later")
      console.error(e.message);
    }
  }
})
.catch((error) => {
  console.log(error);
})
.done();

});
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPlatform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.🌐NetworkingRelated to a networking API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions