Glide FileNotFoundException: No content provider when loading images from internet

时光总嘲笑我的痴心妄想 提交于 2019-12-03 23:26:37

If you are targeting API 28 on and the issue appears on Android 9 and the URL starting with http your issue is with cleartext traffic as mentioned here in Network security configuration

Starting with Android 9.0 (API level 28), cleartext support is disabled by default.

ensure that all connections to are always done over HTTPS to protect sensitive traffic from hostile networks.

If you want to Opt out of cleartext traffic

Add this property on your application manifests only

<application
 . 
 android:usesCleartextTraffic="true"
 .

 >

 </application>

And if you want to have specific domains to have the rule

Create file res/xml/network_security_config.xml

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

AndroidManifest.xml -

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config"
        ...>
        ...
    </application>
</manifest>
Pro Ega

Add to gradle annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!