Download Manager returns unsuccessful download on Android 9.0 NetworkSecurityConfig: No Network Security Config specified, using platform default

This tag worked for me

 android:usesCleartextTraffic="true"

Add this tag to the application

 <application
        android:name=".ApplicationClass"
        android:allowBackup="true"
        android:hardwareAccelerated="false"
        android:usesCleartextTraffic="true"

Solution 2)

Create a XML res/xml/network_security_config.xml

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

in your tag Application inside AndroidManifest.xml

android:networkSecurityConfig="@xml/network_security_config"

Download Manger not working in Android Pie 9.0 (Xiaomi mi A2)


I found the solution through here: How to solve Android P DownloadManager stopping with "Cleartext HTTP traffic to 127.0.0.1 not permitted"?

In short, I just need to do the following:

1.create res/xml/network_security_config.xml, then add

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

2. in manifest file, reference it inside application tag

android:networkSecurityConfig="@xml/network_security_config"

For more info, can read here: https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted