HTTP Failure in Axios Error: Network Error(only on android)
See original GitHub issueDescription
I’m using Axios as my request library.
const client = axios.create({
baseURL: 'https://my.domain.com/api/',
responseType: 'json'
});
Once I request. This error comes in.
HTTP Failure in Axios Error: Network Error
at createError (createError.js:16)
at EventTarget.handleError (xhr.js:83)
at EventTarget.dispatchEvent (event-target-shim.js:818)
at EventTarget.setReadyState (XMLHttpRequest.js:575)
at EventTarget.__didCompleteResponse (XMLHttpRequest.js:389)
at XMLHttpRequest.js:502
at RCTDeviceEventEmitter.emit (EventEmitter.js:189)
at MessageQueue.__callFunction (MessageQueue.js:425)
at MessageQueue.js:112
at MessageQueue.__guard (MessageQueue.js:373)
But it works great on iOS, I did try some solutions, none of them worked for me. But it used to work well, I remembered I did not change anything. It happened suddenly.
React Native version:
System: OS: macOS 10.15.5 CPU: (4) x64 Intel® Core™ i5-7360U CPU @ 2.30GHz Memory: 21.28 MB / 8.00 GB Shell: 5.8 - /usr/local/bin/zsh Binaries: Node: 12.18.3 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.14.6 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 23, 27, 28, 29 Build Tools: 28.0.3, 29.0.3 System Images: android-28 | Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6514223 Xcode: 11.6/11E708 - /usr/bin/xcodebuild Languages: Java: 1.8.0_251 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.2 => 0.62.2 npmGlobalPackages: react-native: Not Found
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Related StackOverflow Question
emulator @<your_emulator_name> -dns-server 8.8.8.8saved my day. For more info Android emulator: when there’s no connection to the internet @freddieerg Thanks, you give me the right clue.my problem was that i used localhost when the emulator had to connect to my ip
10.0.2.2:5000@Liqiankun Yes i did and that returned an error that
-dns-serveris not known as a command