androidhttp請求亂碼
發布時間: 2023-03-07 15:10:36
㈠ android9.0以上http請求失敗的解決方法
在android9.0以上由於安全性高了,所有不做處理http不能使用,有3中解決方法
1.最簡單的方法降級targetSdkVersion的版本
將 targetSdkVersion 將到27或27以下
2.伺服器請求http改為https (推薦)
推薦使用這個方法,畢竟https的安全行高
3.兼容http請求
(1):在清單文件中設置networkSecurityConfig屬性
(2)在res/xml文件夾下創建network_security_config.xml
熱點內容