I/Glide: Root cause (1 of 1)
Cause (1 of 1): class java.io.FileNotFoundException: No content provider:
有以上类似报错信息,原因是http请求被系统禁止。
解决办法:
1. 在res 下xml文件夹中新建一个 network_config.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
2. 然后在AndroidManifest.xml 配置文件中的 application中引用
<application
android:name=".MyApp"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme">
</application>