Odk Collect with Custom Certificate: Android 5 (works), Android 7,8 (fails)

A custom build of ODK Collect is required:

Details are given in the Android docs.

  • Add android:networkSecurityConfig="@xml/network_security_config" to AndroidManifest.xml
  • Create xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config>
        <domain includeSubdomains="true">sgformulare</domain>
        <trust-anchors>
            <certificates src="@raw/sgformulare"/>
        </trust-anchors>
    </domain-config>
</network-security-config>
  • Add certificate /res/raw/sgformulare.crt. Important: remove any headers above ---BEGIN CERTIFICATE--
  • Note that the @raw/sgformulare does not include the extension crt.
  • Build and upload, get QR Code

There must be a better way without custom builds, as Chrome shows. Installing and running Android Studio is not to everybody's liking.