Home > OS >  Location of "network_security_config.xml" file in Flutter
Location of "network_security_config.xml" file in Flutter

Time:08-03

Been trying to find out file named "network_security_config.xml" in flutter. I have no idea where to find it. I do not see any thread here. Sorry for the silly question but can anyone help me since I am going to implement appodeal plugin.

There is only one step which confusing.

"In your network_security_config.xml file, add base-config that sets cleartextTrafficPermitted to true :"

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

Source: https://pub.dev/documentation/stack_appodeal_flutter/latest/

CodePudding user response:

Add the Network Security Configuration file to your AndroidManifest.xml

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

Put your XML configuration under android/app/src/main/res/xml/network_security_config.xml,

In your network_security_config.xml file, add base-config that sets cleartextTrafficPermitted to true :

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