NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400

We Are Going To Discuss About NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400. So lets Start this Java Article.

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400

  1. NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400

    Try these solutions
    Solution 1)
    Add the following attribute to the <application tag in AndroidManifest.xml:
    android:usesCleartextTraffic="true"

  2. NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400

    Try these solutions
    Solution 1)
    Add the following attribute to the <application tag in AndroidManifest.xml:
    android:usesCleartextTraffic="true"

Solution 1

Try these solutions

Solution 1)

Add the following attribute to the <application tag in AndroidManifest.xml:

android:usesCleartextTraffic="true"

Solution 2)

Add android:networkSecurityConfig="@xml/network_security_config" to the <application tag in 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:networkSecurityConfig="@xml/network_security_config"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

With a corresponding network_security_config.xml in app/src/main/res/xml/:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

enter image description here

Refer this answer for more info:
Download Manger not working in Android Pie 9.0 (Xiaomi mi A2)

Original Author Quick learner Of This Content

Solution 2

Edited Answer
Remove <domain includeSubdomains="true">secure.example.com</domain> from the code.

Use just:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

And It will work for any URL or IP.

Try to set cleartextTrafficPermitted=false

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
       <domain includeSubdomains="true">secure.example.com</domain>
    </domain-config>
</network-security-config>

Original Author Insane Developer Of This Content

Solution 3

i was also facing the same problem ,and tried many solutions(adding config etc things),but they didn’t work for me..I sit and checked my code carefully, There was something wrong in the code which i’ve wrote to access the node. Not a syntactic error, it’s node name missmatch.

Original Author Rathan RockyIdiot Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment