Android network-security-config does not work in API 24 version and below

232 Views Asked by At

I'm create android app witch is use backend server. This server use https connection and also use self signed certificate. To be able to communicate with server from android app I've use network-security-config.xml. Here is the file:

<network-security-config>

<base-config>
    <trust-anchors>
        <certificates src="system"/>
        <certificates src="@raw/sslcert"/>
    </trust-anchors>
</base-config>

</network-security-config>

On android API 25+ it work well, but on API 24 and less it does not work and I get an error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

It seems that I should configurate some how trust anchor for API 24 and less, but I don't know how.

I will glad to see any suggestion.

0

There are 0 best solutions below