I ran into the same issue in the Android emulator where I was trying to access an external HTTPS URL with a valid certificate. But getting this url in reaction-native failed
'fetch error:', { [TypeError: Network request failed] sourceURL: 'http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false' }
1) To find out the exact error in the logs, I first turned on "Debugging JS Remote" using Cmd + M in the application
2) The error message was
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
3) I added a valid URL certificate using this method -> STEP 2
http://lpains.net/articles/2018/install-root-ca-in-android/
This certificate is added to the User tab.
4) Add android:networkSecurityConfig in AndroidManifest.xml
Add the network security configuration file res/xml/network_security_config.xml:
<network-security-config> <base-config> <trust-anchors> <certificates src="user"/> <certificates src="system"/> </trust-anchors> </base-config> </network-security-config>
This should work and give you the expected answer.
henryoats May 13 '19 at 10:46 p.m. 2019-05-13 22:46
source share