Hello Friends 👋,
Welcome To Infinitbility! ❤️
TypeError Network request failed in android, ios, or with SSL server then read all below cases.
In this article, we solve 3 cases of network request failed issue in react-native but your condition does not match with the below mention cases then comment below on the article.
Case 1: http url not working in android
if you are trying to call HTTP ( unsecured ) url then you have to add
usesCleartextTraffic to your
1<application2 ...3 android:usesCleartextTraffic="true" <!-- add this line -->4 >5 ...6</application>
Trying to call localhost api with diffrent port?
Replace localhost with your ipaddress v4
To know your ipv4
- For windows users
- For Mac or linux users
HTTP URL not working in ios
If you are trying to call an unsecure url from reac native ios.
you have to do below changes on your info.plist to allow unsecure url
1<key>NSAppTransportSecurity</key>2<dict>3 <key>NSAllowsArbitraryLoads</key>4 <true/>5</dict>
HTTPS URL not working in android react native fetch
You are trying to call HTTP URL from react-native fetch but getting Network request failed to issue or in ios working fine then below the solution for you only.
This has to do with Android not trusting my SSL certificate. Apparently Android has some additional trust requirements on top of what web browsers require.
After figuring that out, the root cause ended up being my SSL Certificate uploaded to AWS didn’t have the correct intermediate cert which was fine in chrome, but not in android.
check your SSL certificate set up perfectly or not on https://www.digicert.com/help/.
when you get an error on DigiCert assign a task to your server administrator 😁.
More From React Native Tutorial
- Introduction To React Native
- React Native Environment Setup using expo
- React Native Environment Setup for windows
- React Native Environment setup on Mac OS
- React Native Environment setup on linux
- React Native Project Structure
- React Native State
- React Native Props
- React Native Styling
- React Native Flexbox
- React Native Text
- React Native Textinput
- React Native Commands
- React Native ScrollView
- React Native Dark Mode
- React Native Fonts
- React Native SQLite
- React Native DatepickerAndroid
- React native ScrollView scroll to position
- How to align icon with text in react native
- React Native Image
- React Native Firebase Crashlytics
- React Native Async Storage
- React Native Share
Error & Issue Solution
- Task :app:transformDexArchiveWithDexMergerForDebug FAILED In React Native
- Expiring Daemon because JVM heap space is exhausted In React Native
- Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED In React Native
- Unable to determine the current character, it is not a string, number, array, or object in react native
- App crashed immediately after install react native video or track player
- how to delete SQLite database in android react native
- React native material dropdown twice click issue
- How to get the current route in react-navigation?
- how to disable drawer on the drawer navigation screen?
- Image not showing in ios 14 react native
- React Native image picker launchimagelibrary on second time issue
- how to open any link from react native render Html
- Network request failed in react native fetch
- React Native upload video example