I have published our first Xamarin Android App in the store about 1 month ago, and it was working just fine.
Suddenly, it started to throw the Javax.Net.Ssl.SSLHandshakeException: Unacceptable certificate
exception on the first API call attempt. We found out that one of the security certificate on our API server firewall was expired, so we updated it.
After updating the certificate, the app started to throw the java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
exception on the first API call attempt. After some research, I discovered that I should add a certificate file to the app and make some certification authorities configurations. Following the documentation instructions I asked our security department for the certificate.pem
file, added it to the Resources/raw/my_ca
folder (which I created manually) and created a network_security_config.xml
file under the Resources/xml
folder of the Xamarin Android project:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config>
<domain includeSubdomains="true">mydomain.com.br/api</domain>
<trust-anchors>
<certificates src="@raw/my_ca/certificadopem"/>
</trust-anchors>
</domain-config>
</network-security-config>
And now I am getting the folowing error: invalid file path 'E:\MyProjectPath\MyApp.Android\obj\Debug\120\res\raw\my_ca\certificadopem.pem'.
I have checked and the file exists. I tried deleting the bin and obj folders and cleaning/rebuilding the solution, but didn't work.
I HAVE to get the app back online, but I can't make it work. What am I missing here?