Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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)

12-13 19:00:25.389 1776-1776/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument 12-13 19:00:57.960 1706-1751/? E/storaged: getDiskStats failed with result NOT_SUPPORTED and size 0 12-13 19:01:05.180 2522-22392/com.google.android.gms.persistent E/WakeLock: GCM_HB_ALARM release without a matched acquire! 12-13 19:01:05.601 2522-22605/com.google.android.gms.persistent E/NetworkScheduler: Invalid component specified. 12-13 19:01:16.094 1933-2653/system_process E/memtrack: Couldn't load memtrack module

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

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;

Step 1: GOTO res->New->android resource directory. Create your xml resource directory

enter image description here

Step 2: Create a new Resource File (with the name: 'network_security_config') inside the newly created xml resource directory by navigating through (xml->New->XML Resource File).

enter image description here

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>

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" >

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...