Fetch not working on Android 9 API 28
Problem
🐛 Bug Report Hello, I'm having an Issue about a HTTP service (the error only in simulator with API 28 (Pie) environment). I already add the domain on react_native_config.xml and add the networkSecurityConfig on both Manifests.xml (debug and release) but still get the TypeError: Network request failed error: I already try all this Issues: #23986, #23984 My info: info React Native Environment Info: System: OS: macOS 10.14.2 CPU: (8) x64 Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz Memory: 318.58 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 11.8.0 - /usr/local/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 Android SDK: API Levels: 25, 26, 27, 28 Build Tools: 25.0.0, 25.0.1, 26.0.2, 27.0.3, 28.0.3 System Images: android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.3 AI-182.5107.16.33.5199772 Xcode: 10.2/10P91b - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.0 => 0.59.0 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7 My react_native_config.xml: <network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="false">acolhebrasil.com.br</domain> </domain-config> <domain-config cleartextTrafficPermitted="true"> <domain inclu
Error Output
error only in simulator with API 28 (Pie) environment). I already add the domain on react_native_config.xml and add the networkSecurityConfig on both Manifests.xml (debug and release) but still get the Type
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Fetch not working on Android 9 API 28
@mrkacan Many people use `localhost` for their api in development and many also do not have their `localhost` setup with `https` yet. I think this is a common enough use case that it should be supported.
Trust Score
6 verifications
- 1
@mrkacan Many people use `localhost` for their api in development and many also
@mrkacan Many people use `localhost` for their api in development and many also do not have their `localhost` setup with `https` yet. I think this is a common enough use case that it should be supported.
Validation
Resolved in facebook/react-native GitHub issue #24627. Community reactions: 23 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep