解决: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,第1张

概述Androidstudio版本:3.5.2API30问题在使用okhttp+gson请求网络数据并解析的时候,请求解析失败:部分报错信息如下:qemu_pipe_open_ns:Couldnotconnecttothe‘pipe:qemud:network’service:InvalidargumentRemoteConnectionfailedtoinitialize:RemoteCon

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清单文件application标记中配置降低安全级别解决
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" 


参考: https://www.it1352.com/2078606.html

总结

以上是内存溢出为你收集整理的解决: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所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1056013.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存