I'm trying to test my android app locally.The app has to fetch data from 192.168.1.16.
The local server certificate is a self signed certificate, so I did what I found here and there on stackoverflow and other sites (special thanks to https://stackoverflow.com/a/71542188/3872061):
. stored the certificate in res/raw/laragon_certif
. created a res/xml/network_security_config.xml pointing to the @raw/laragon_certif
. added attribute android:networkSecurityConfig="@xml/network_security_config" on node application in manifest.xml
Now all previous errors and exceptions changed to the following:
javax.net.ssl.SSLPeerUnverifiedException: Hostname 192.168.1.16 not verified: certificate: sha1/Gr8h0ea/mhIMIADb7CMK47K8Moo= DN: CN=laragon,OU=IT,O=Laragon,L=Singapore,ST=Singapore,C=SG subjectAltNames: [localhost, ..., ..., ..., 192.168.1.16]
So it seems the app correctly finds the self-signed certificate and does not reject it any more, but it doesn't consider 192.168.1.16 to be covered by this certificate.