# No network security config specified, using platform default

Network security is a major issue, and in the tech world we live in, maximum work is being done online. Especially after the pandemic, most of the world's business has gone online. For this reason, if the work done on the Internet is not secure, then who will use this platform. Experts are always working to make this platform secure and faster than in the past. In recent past years, the Internet used to work with the HTTP protocol, now the HTTPS protocol has been introduced to make it secure further and faster. In this article, we will discuss the issue of network security which is more due to the change of this protocol in Android Apps.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0e09rqsycs0ybmhglyoj.png)

## What is No network security config specified, using platform default
Without affecting app code, the Network Security Configuration feature allows apps to customize their network security settings in a secure, declarative configuration file. These options can be customized for individual sectors and applications. The following are the main features of this feature:

**Custom trust anchors:** Select which Certificate Authorities (CAs) are trusted for secure connections in an app. For example, the app can trust just certain self-signed certificates or limit the public CAs it trusts.

**Overrides for debugging only:** Debug secure connections in a program without putting the installed base at risk.

**Opt-out from cleartext traffic:** Apps should be protected from cleartext traffic being used inadvertently.

**Pinning certificates:** to an app's secure connection: Restrict an app's secure connection to specific certificates.

The app is probably being run on a version of Android below 5.0 when the feature was introduced. This message is harmless, but it may confuse some developers. This is a problem with API 28 and later because it no longer accepts HTTP requests; you must update if you wish to accept HTTP or localhost requests. If you are seeing this, it means that no network security configuration is specified. This is because the platform default settings have been used instead.

## Why does this error trigger
When an app wants to use the HTTP protocol which is no longer quite acceptable, any app that wants to use this protocol, without setting the protocol, will see this error message.

This is a more common error in API 28 or later versions, but earlier versions of API 28 do not throw any error message and the application runs properly. Before API 28, both protocols worked well. HTTP is now being phased out so this error message can also be seen more frequently, it also can be seen on the local host machines.

## The Solution
It's easy to get rid of this error message. Below are some codes. Add these lines to your program and get rid of this error message.

Add this code in the AndroidManifest.xml which is located at app/src/main/AndroidManifest.xml

```
<application

        android:name=".ApplicationClass"

        android:allowBackup="true"

        android:hardwareAccelerated="false"

        android:icon="@mipmap/ic_launcher"

        android:label="@string/app_name"

        android:largeHeap="true"

        android:usesCleartextTraffic="true"

        android:networkSecurityConfig="@xml/network_security_config"

        android:supportsRtl="true"

        android:theme="@style/AppTheme">
```
Create a file with the name network_security_config.xml at app\src\main\res\xml and add this code in it.

```
<?xml version="1.0" encoding="utf-8"?>

<network-security-config>

    <base-config cleartextTrafficPermitted="true" />

</network-security-config>
```  
## The Conclusion
This is a common error of Android Studio, the solution is explained above. What happens is that newcomers are bothered by any error message while seasoned programmers enjoy bug hunting. The best thing to do is to learn, the learning process is continuous and everlasting. I will always welcome your feedback and questions in the comment section.
 
