-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
React-Native Network request failed on Android Emulator API 16-19 with specific SSL Cipher suite #23986
Comments
I also met this situation. |
have the same problem, but only with local ip address, and API 28. So, I think it's not really emulator API version issue my error
What is interesitng, if I switch on remote debugging it can send a request, but then fails on handling
|
Same problem here after upgrading from 0.57 to ReactNative 0.59.1. ENV INFO: |
My friend tried this bug at his side and he used another testing website https://www.json-generator.com and it works,
and for www.json-generator.com which is working fine, The Cipher suites are:
And found this page https://developer.android.com/guide/topics/security/cryptography?authuser=1#SupportedSSLSocket Which says none of the 'reqres.in' Cipher suites where compatible with API 16-19. |
Hey 👋 thank you for raising this issue; starting with Android 9 (API level 28 - RN 59 builds with 28), cleartext traffic support is disabled by default. @jahicDario @vitalii I think this applies to your issue; we added some network security config rules as part of 59 but these will only apply to new apps created through @areeb111 I think there may be two different issues going on here, if the cleartext configuration change is unrelated please could you let me know. Thank you |
Thank you Salakar, |
I'm seeing the same thing, "Uncaught Error: unsupported BodyInit type" after upgrading react-native to 0.59.1. Hopefully the following helps someone debug this further:
This is preventing me from debugging anything which makes a network call in Android so it would be great if someone could look at this. Thanks! Stack TraceClick to expand
|
The same error like @plowman described. Also tried with axios (just Network error with status code 0) and on API 25 and 28. |
Ok. Ive found a workaround:
<application
...
android:usesCleartextTraffic="true"
...> |
The fix is landed in the master, but still requires some manual configuration in build.gradle. Please see #23984 for more information. Feel free to comment if issue persists with workaround, and I'll re-open this. |
Fixed for me with add android:usesCleartextTraffic="true" to ./adnroid/app/src/main/AndroidManifest |
Thanks it's now fixed! |
Hi, i'm having the same problem, i have the latest certs and am using android PI on the emulator (28) Should i go for the fix mentioned in #23984 Edit: |
Hello, I'm having the same 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: My info: My react_native_config.xml: acolhebrasil.com.br localhost 10.0.2.2 10.0.3.2My fetch:
My API: http://acolhebrasil.com.br/Sistema/api/#/ Console: |
This fixed it for me with apollo client. |
For detailed information you can refer to this: I will quote from the article:
|
Worked the first time I lunch the app (release) but if I close it and open again, it can't connect to the api again |
still didnt resolve the issue. i removed the ./android/app/src/debug folder, added the android:usesCleartextTraffic application tag inside ./android/src/main/AndroidManifest.xml but still showing below error. Please anybody help TypeError: Network request failed |
Add the codes in your main AndroidManifest.xml manifest => xmlns:tools="http://schemas.android.com/tools" And make sure u still use http:// not https:// to fetch . it can working on Android 9 with API 28 |
thanks @RageOfJustice it worked but i dont understand why deleting debug folder, can you please mention the reason for deleting debug folder |
android:usesCleartextTraffic="true" in the manifest work for me. Thankyou |
I am facing this issue on android device , on emulator its workling fine , |
I had the same while I was using Fetch API, I just couldn't connect to server even it had SSL certificate, then I started to use axios and it's working! |
It's working! |
Thank you, it's working |
@RageOfJustice thank you so much .. its worked for me. |
Just adding android:usesCleartextTraffic="true" worked for me. If you're using localhost API, make sure to put your IPV4 instead of use localhost, example:
|
@dulmandakh thanks !! |
Hello, I also had this error, but I forgot the file to create ".ENV". |
After adding
|
In my case i already have this, just need to delete debug folder and it works! Thanks |
network request failed in Android 9 all this solution not working.
React Native "react-native": "0.60.0" |
and if your api is running on localhost: do the following |
🐛 Bug Report
To Reproduce
This bug is related to React-Native v0.59.1
react-native init testnet
render()
Try to run project on Android Emulator running on API 16-19 with Google APIs,
You will have this error:
Notes:
It seems the whole project cannot access internet connectivity,
I have the permission in the manifest to access internet
<uses-permission android:name="android.permission.INTERNET" />
Otherwise you can test the same project on Android Emulator running on API 20 or later.
Expected Behavior
Expected console log output with
'TESTOUTPUT', 12
.Code Example
https://snack.expo.io/@areeb111/testnet
Environment
The text was updated successfully, but these errors were encountered: