Skip to content

"NETWORK ERROR" when making API call in react-native Android, while works in iOS #31045

@prayaslashkari

Description

@prayaslashkari

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

API calls not working in Android devices, while its working in iOS simulator and device

My BaseUrl -> 'http://167.XXX.XX.89'

My network_security_config.xml
image

I've included this file (network_security_config.xml) in AndroidManifest.xml (android/app/src/main) too.

My FLIPPER_VERSION
image

Also I've commented out
image

API calls are successfully working in iOS devices but not working in android.

ERROR
image

React Native version:

image

System:
OS: macOS 11.2.1
CPU: (8) x64 Apple M1
Memory: 33.83 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.3 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.9 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 29
Build Tools: 28.0.3, 29.0.2
System Images: android-29 | Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.7042882
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_282 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: ^16.13.1 => 16.14.0
react-native: ^0.63.2 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Tried making API calls in Android.
  2. Its not working, its working in iOS devices.

Expected Results

Successful API Calls.

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

Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem.
You may provide a screenshot of the application if you think it is relevant to your bug report.
Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions