androidxmlsecuritynetwork-programming

Error in configuring network security xml in android


In the android network security docs , it says to create a network_security_config.xml file in res/xml folder.

In order to make an entry in manifest file, it says to make an entry in this way

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

But I am getting the error No resource identifier found for attribute 'networkSecurityConfig' in package 'android'

I also checked for the valid attributes in application tag ( android docs ), there is no attribute as "networksecurityconfig"


Solution

  • You need to set your compileSdkVersion to 24 or higher and set your buildToolsVersion to 24.0.0 or higher.

    With regards to the documentation, that's a documentation bug.