问题AndroID studio版本: 3.5.2
API 30
在使用okhttp+gson请求网络数据并解析的时候,请求解析失败:部分报错信息如下:
qemu_pipe_open_ns: Could not connect to the ‘pipe:qemud:network’ service: InvalID argument
RemoteConnection Failed to initialize: RemoteConnection Failed to open pipe
无法打开QEMU管道’qemud:network’:无效的参数(Failed to open QEMU pipe ‘qemud:network’: InvalID argument)
报错原因:
因为AndroID Emulator在7.0版本及以上提高了对不安全请求的限制级别,当我们的应用尝试向不安全的远程API(http)发送/接收请求/响应时,无法通过安全请求,就会发生这种情况。
androID:usesCleartextTraffic="true"
上面这个方法可以解决,但是缺点就是它倾向于对数据完整性构成威胁.所以我们更多选择下面这种方法来解决
方法二: 配置安全权限右键res-> New-> AndroID Resource Directory。创建一个名为xml
的资源目录右键上面新建的xml文件夹:xml-> New-> AndroID Resource file命名为:
network_security_config
并加入如下代码:<?xml version="1.0" enCoding="utf-8"?><network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">your_site_domain.com</domain> </domain-config></network-security-config>
到你 AndroIDManifest清单文件的应用程序application标记引用该文件androID:networkSecurityConfig="@xml/network_security_config"
以上是内存溢出为你收集整理的解决:qemu_pipe_open_ns:62: Could not connect to the ‘pipe:qemud:network‘ service: Invalid argument 202全部内容,希望文章能够帮你解决解决:qemu_pipe_open_ns:62: Could not connect to the ‘pipe:qemud:network‘ service: Invalid argument 202所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)