导致上面问题的原因是:Andriod 9 系统更新,组织Http 不安全请求,解决办法:
解决方法:

如果你的应用加了信鸽推送的 Andriod P 兼容方案,那么你只需要在下面添加:
<base-config cleartextTrafficPermitted ="true" />
2.清单文件添加:

加上下面这个就行,位置看图,
android:networkSecurityConfig="@xml/xg_network_security_config"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:networkSecurityConfig">
如果你的tools:replace 原本已经存在,直接添加下面这样 ,用“,”分割,后面添加就好
tools:replace="android:theme,android:allowBackup,android:name,android:icon,android:networkSecurityConfig">
3.添加这个
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
4.如何你的编译不通过,试试这样:
编译APK时使用compileSdkVersion和targetSdkVersion都使用28
网友评论