Android版本28使用http请求报错not permitted by network security policy
Android版本28使用http请求报错not permitted by network security policy
android模拟器调试登录的时候报错 CLEARTEXT communication to to 52.76.xx.xxx not permitted by network security policy
2018-10-17 20:42:09.532 18048-18048/com.aax.exchange E/ProgressObserver____: onError:
java.net.UnknownServiceException: CLEARTEXT communication to 52.76.xx.xxx not permitted by network security policy
问题: 由于 Android P(版本27以上) 限制了明文流量的网络请求,非加密的流量请求都会被系统禁止掉。
如果当前应用的请求是 htttp 请求,而非 https ,这样就会导系统禁止当前应用进行该请求
推荐的做法是服务器和本地应用都改用 https ,测试时为了方便使用http,上线时应该都会用https才比较安全。
解决办法:1.在 res 下新建一个 xml 目录,然后创建一个名为:network_security_config.xml 文件 ,该文件内容如下:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
在 AndroidManifest.xml application增加配置android:networkSecurityConfig="@xml/network_security_config"
后不报错了
2:服务器和本地应用都改用 https (推荐)
3:targetSdkVersion 降级回到 27
Android版本28使用http请求报错not permitted by network security policy的更多相关文章
- Android版本28使用http请求
Android版本28使用http请求报错not permitted by network security policy android模拟器调试登录的时候报错 CLEARTEXT communic ...
- 安卓工作室 android studio 汉化后,报错。 设置界面打不开。Can't find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label
安卓工作室 android studio 汉化后,报错. 设置界面打不开. Android studio has been sinified and reported wrong.The setup ...
- mysql 5.7.28 中GROUP BY报错问题 SELECT list is not in GROUP BY clause and contains no
----mysql 5.7.28 中GROUP BY报错问题 SELECT list is not in GROUP BY clause and contains no------ 解决方案: sel ...
- Android Studio使用org.apache.http报错
Android Studio使用org.apache.http报错需要加上这句话:useLibrary 'org.apache.http.legacy'
- Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Xcode7 beta 网络请求报错:The ...
- Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport
Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Xcode7 beta 网络请求报错:The ...
- nuget包管理nuget服务器发布包时出现请求报错 406 (Not Acceptable)
在window服务器上部署nuget服务器时,发布包时出现请求报错 406 (Not Acceptable) 验证用户名.密码正确的情况下,还是出现上面错误.后面跟踪服务器日志,发现window\te ...
- git https 请求报错 504
git https 请求报错 504 原因可能是因为设置了代理,ubuntu/deepin 系统可以检查 /etc/profile ~/.bashrc 内有没有设置 https 的代理. 有的话,去掉 ...
- JS请求报错:Unexpected token T in JSON at position 0
<?php /* 最近做一个ajax validate表单验证提交的代码,在ajax提交的时候 JS请求报错:Unexpected token T in JSON at position 0 描 ...
随机推荐
- flask --- 02. 路由, 初始化配置,蓝图
一.Flask 路由 1.添加路由的方式 ① ② 实例: ① @app.route("/my_de") def detail() ② def detail() app.add_ur ...
- Unicode编码问题 如:\u529e\u7406\u9996\u6c7d\u52a0\u6cb9
python 遇到\u529e\u7406\u9996\u6c7d\u52a0\u6cb9 解决方法: a = "\u529e\u7406\u9996\u6c7d\u52a0" b ...
- Go 使用 JSON
Encode 将一个对象编码成 JSON 数据,接受一个 interface{} 对象,返回 []byte 和 err func Marshal(v interface{}) {[]byte,err} ...
- ES6 常用总结(前端开发js技术进阶提升总结)
一.变量声明const和let 在ES6之前,我们都是用var关键字声明变量.无论声明在何处,都会被视为声明在函数的最顶部(不在函数的最顶部就在全局作用域的最顶部).这就是函数变量提升例如: 不用关心 ...
- 第 8 章 容器网络 - 062 - 如何使用 flannel host-gw backend?
flannel host-gw backend flannel 支持多种 backend:(1)vxlan backend:(2)host-gw: 与 vxlan 不同,host-gw 不会封装数据包 ...
- 『Python CoolBook:heapq』数据结构和算法_heapq堆队列算法&容器排序
一.heapq堆队列算法模块 本模块实现了堆队列算法,也叫作优先级队列算法.堆队列是一棵二叉树,并且拥有这样特点,它的父节点的值小于等于任何它的子节点的值. 本模块实际上实现了一系列操作容器的方法,使 ...
- pandas的数据结构之series
Pandas的数据结构 1.Series Series是一种类似于一维数组的对象,由下面两个部分组成: index:相关的数据索引标签 values:一组数据(ndarray类型) series的创建 ...
- 数据结构与算法之PHP排序算法(归并排序)
一.基本思想 归并排序算法是将两个(或两个以上)有序表合并成一个新的有序表,即把待排序序列分为若干个子序列,使每个子序列有序,再将已有序的子序列合并,得到完全有序的序列.该算法是采用分治法(Divid ...
- OpenRASP安装使用教程
一.说明 1.1 RASP和WAF的区别 WAF,Web Application Firewall,应用防火墙.其原理是拦截原始http数据包,然后使用规则对数据包进行匹配扫描,如果没有规则匹配上那就 ...
- npm 设置和取消代理配置
设置代理npm config set proxy=http://127.0.0.1:8087npm config set registry=http://registry.npmjs.org12关于h ...