Android9.0加载图片报错IOException: Cleartext HTTP traffic to preview.qiantucdn.com not permitted
Android9.0 默认是禁止所有的http请求的,需要在代码中设置如下代码才可以正常进行网络请求: android:usesCleartextTraffic=“true”。
<application
android:name="xx.xx.xx"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
本文主要讨论了在Android 9.0上使用Glide加载图片时遇到的IOException问题,由于系统默认禁止HTTP请求,需要通过在AndroidManifest.xml中设置android:usesCleartextTraffic为"true"来允许明文HTTP流量,从而解决图片加载失败的问题。
1523

被折叠的 条评论
为什么被折叠?



