Network error in axios and react-native after bundle release

See original GitHub issue

I’m using react-native and axios to request,in debug model,everything is fine,but when bundle release,it occurs to the ‘Network error’ in my phone. React Native version:0.60.4

System: OS: Windows 10 CPU: (8) x64 Intel® Core™ i7-4790 CPU @ 3.60GHz Memory: 2.70 GB / 7.89 GB Binaries: Node: 10.15.3 - D:\node\node.EXE Yarn: 1.16.0 - D:\node\yarn.CMD npm: 6.4.1 - D:\node\npm.CMD

Steps To Reproduce

  1. cd android
  2. ./gradlew assembleRelease
  3. and install the bundle apk file in my phone
  4. when i request use axios,the error just happended
  5. but when i run react-native run-android,everything is fine.

image

Describe what you expected to happen:

it is normal in bundle release.

Snack, code example, screenshot, or link to a repository: image image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:8

github_iconTop GitHub Comments

20reactions
waleedarshadcommented, Sep 16, 2019

Try "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json"

11reactions
habilcommented, Sep 1, 2019

Same here. “react-native”: “0.59.3”

I found the solution : https://github.com/facebook/react-native/issues/24039

Read more comments on GitHub >

github_iconTop Results From Across the Web

Network error with axios and react native - Stack Overflow
If you are trying to call localhost on android simulator created with AVD, replacing localhost with 10.0.2.2 solved the issue for me.
Read more >
React Native [AxiosError: Network Error] HTTP Fetching iOS ...
React Native cannot fetching using HTTP, so need HTTPS for ... React Native [ AxiosError : Network Error ] HTTP Fetching iOS and...
Read more >
Using Axios with React Native to manage API requests
Learn how to supercharge your API network requests in React Native with Axios in this comprehensive tutorial.
Read more >
React Native throw Network Error when using Axios or Fetch ...
Coding example for the question React Native throw Network Error when using Axios or Fetch in android-React Native.
Read more >
Axios Network Error when making HTTP request [Solved]
The URL has to include the protocol, e.g. http:// or https:// if you're testing on localhost without an SSL certificate. · The path...
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