How to add xml to android resources

Hello! I need to add network_security_config for android manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest>
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config">
    </application>
</manifest>

Here is the file

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">127.0.0.1</domain>
    </domain-config>
</network-security-config>

I added this file to bundle resources
Π‘Π½ΠΈΠΌΠΎΠΊ экрана 2023-08-22 Π² 15.05.49


and i get this file in the apk, but how do i point to it in the manifest? because the file did not get into the res folder

thank you for any help!

Hi there!

The file must live in the β€œres/xml” folder:
Network security configuration | Android Developers

Try this folder structure - this should work:

Screenshot 2023-08-22 160646

5 Likes

Wow! just simple. It works for me.
thank you!

2 Likes