Glide是一个用于加载图片的框架,但这次却出了问题。。。加载不出图片了???
首先并没有什么骚操作,正常加载,一开始以为是依赖出了问题啥,一顿好找,摸不着头脑,但改了之后还是无法加载出来,这时我很大程度上就觉得是Android系统的问题了。最终还是和我想的一样。
解决方案
在AndroidManifest.xml加入android:usesCleartextTraffic="true"
<application
android:name=".MyApplication"
......
android:usesCleartextTraffic="true" />
Declare that this application may use cleartext traffic, such as HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP without STARTTLS or TLS). Defaults to true. If set to false {@code false}, the application declares that it does not intend to use cleartext network traffic, in which case platform components (e.g. HTTP stacks, {@code DownloadManager}, {@code MediaPlayer}) will refuse applications's requests to use cleartext traffic. Third-party libraries are encouraged to honor this flag as well.
声明此应用程序可以使用明文通信,例如http而不是https;websockets而不是websockets secure;xmpp、imap、stmp而不使用starttls或tls)。默认为true。如果设置为false{@code false},则应用程序声明不打算使用明文网络通信,在这种情况下,平台组件(例如http堆栈、{@code downloadmanager}、{@code mediaplayer})将拒绝应用程序使用明文通信的请求。我们也鼓励第三方库尊重它。
觉得是用来兼容低版本,看下面参考:
参考:
Android高版本联网失败报错:Cleartext HTTP traffic to xxx not permitted解决方法