11/08/2024 16:35:55
问题描述
场景一:Android 9.0系统,未安装微信,扫码登录失败。返回日志中报错“Cleartext traffic not permitted”,如下图所示。
场景二:Android 9.0系统,未安装手Q,选择QQ登录。提示“登录失败,请重试,错误码9999”,如下图所示。正常应该拉起QQ下载页面。
回调日志中也可以看到以下报错:
GetLoginError {"openid":"","token":"","token_expire_time":0,"first":0,"reg_channel_dis":"","user_name":"","gender":0,"picture_url":"","pf":"","pfKey":"","need_name_auth":false,"channelID":0,"channel":"","channel_info":"","confirm_code":"","confirm_code_expire_time":0,"bind_list":"","methodNameID":112,"retCode":9999,"retMsg":"QQ login error occur","ret":-1,"msg":"onError msg = net::ERR_CLEARTEXT_NOT_PERMITTED","extraJson":""}
问题原因
以上报错,是由于Android 9.0系统禁止了App使用所有未加密的链接,如果使用http访问需要更改网络安全配置。
解决方案
更改网络安全配置,在AndroidManifest.xml文件的application标签下添加如下配置即可。
android:usesCleartextTraffic="true"
Copyright © 2024 MSDK.
All rights reserved.
All rights reserved.