How to Allow Cleartext Traffic

You could be using non-secure connection to Document Engine in various circumstances — for example, while using our examples, or while developing on your own local server without setting up HTTPS. This used to work fine on older Android versions, however, since Android 9 (API level 28), cleartext support is disabled by default.

When the cleartext traffic is disabled by the network security policy, you’ll encounter the following errors when connecting to your server with Instant:

E/Instant::Sync: Could not authenticate default layer of document '***' for download: InstantError 5: Connection dropped"

Or:

E/Instant::Sync: Could not authenticate default layer of document '***' for download: InstantError 5: CLEARTEXT communication to *** not permitted by network security policy

How to Enable Cleartext Traffic with Your Server

To allow a cleartext connection to your development server, you’ll need to set up a network security policy configuration in your <application> tag inside AndroidManifest.xml:

<application android:networkSecurityConfig="@xml/network_security_config">

Specify the configuration for your domain inside the network security configuration file:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">your_server_domain</domain>
    </domain-config>
</network-security-config>

For more information about the network security configuration, refer to the Network Security Configuration guides.