Note: this is a followup question. I'm trying to allow http traffic in the android manifest of a react native application.
As explained here, I created a xml file:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">192.168.1.61</domain>
</domain-config>
</network-security-config>
and referenced it in the manifest, in the element :
android:networkSecurityConfig="@xml/network_security_config"
At compile time, I have the following error:
Manifest merger failed : Attribute application@networkSecurityConfig value=(@xml/react_native_config) from AndroidManifest.xml:17:7-67 is also present at AndroidManifest.xml:17:7-67 value=(@xml/network_security_config). Suggestion: add 'tools:replace="android:networkSecurityConfig"' to element at AndroidManifest.xml:7:5-138 to override.
I tried the suggested workaround but the error is still here.
What is the correct way to achieve what I want?
I have the same issue.
For react native, i found that it already has react_native_config.xml at project/android/app/src/debug/res/xml/react_native_config.xml
just add your domain in react_native_config.xml example
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">example.com</domain>
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
</network-security-config>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With