问题描述
我正在尝试将很多图像同时上传到在线服务器,但是我无法收到此错误EPIPE(断管)
I'm trying to upload a lot of images to online server in the same time, but i can't i got this error EPIPE(broken pipe)
推荐答案
在Android模拟器/设备版本> = 6.0上可以看到此错误.当您的应用尝试向不安全的远程API(http)发送/接收请求/响应时,就会发生这种情况.这就是为什么您应该坚持通过安全通道(http s )与远程API进行通信的原因.但是您可以通过将 usesCleartextTraffic 属性设置为"true"来解决此问题.在您的Android清单文件的 application 开头标签中.
This error could be seen on Android Emulator/Device Version >= 6.0.It occurs when your app tries to send/receive request/response to a remote API that is not secure (http). That's the reason why you should stick to communicating with remote API's via a secured channel (https). But you can resolve the issue by setting the usesCleartextTraffic attribute to "true" inside the application opening tag of your android manifest file.
<application
android:usesCleartextTraffic="true" >
上述技巧解决了该问题,但是它倾向于对数据完整性构成威胁.因此,您可以通过设置并利用网络安全配置文件来使其变得更好.这样就可以做到;
The aforementioned tip solves the problem, but it tends to open a threat to data integrity. Thus you can make it better by setting up, and leveraging on a network security configuration file. This can be done thus;
第1步:GOTO res->新建-> android资源目录.创建您的xml资源目录
Step 1:GOTO res->New->android resource directory. Create your xml resource directory
步骤2:在新创建的xml资源目录中创建一个新的资源文件(名称:"network_security_config")通过浏览(xml-> New-> XML资源文件).
Step 2: Create a new Resource File (with the name: 'network_security_config') inside the newly created xml resource directoryby navigating through (xml->New->XML Resource File).
第3步:将下面的代码粘贴到新创建的"network_security_config.xml"文件中
Step 3: Paste the code below into the newly created 'network_security_config.xml' file
<?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>
第4步:转到您的AndroidManifest.xml文件,并在应用程序中添加代码 android:networkSecurityConfig ="@@ xml/network_security_config" >您的Android清单文件的打开标签.
Step 4: Goto your AndroidManifest.xml file and add the code android:networkSecurityConfig="@xml/network_security_config" inside the application opening tag of your android manifest file.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config" >
这篇关于无法打开QEMU管道'qemud:network':无效的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!