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"
The Network Security Configuration feature lets apps customize their network security settings in a safe, declarative configuration file without modifying app code. These settings can be configured for specific domains and for a specific app.
Cleartext is any transmitted or stored information that is not encrypted or meant to be encrypted. When an app communicates with the server using a cleartext network traffic, such as HTTP, it could raise the risk of eavesdropping and tampering of content. If you are using the https, then no worry about this issue.
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.
The documentation is fixed, the xml should live inside res/xml which is not in the root but inside android/app:
android/app/src/main/res/xml/network_security_config.xml
From minimumSDK 20 you will need the file and be sure to whitelist localhost and 10.0.2.2 and 10.0.3.2 or you'll have trouble on development
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