I have a strange problem with certificate pinning.
If I use network-security-config xml with raw certificate it works. But if I switch to sha256 pinning in the same file, it doesn't work o_O
I checked 10 times whether I'm using a correct sha256. Even okhttp certificate pinner (from which I'm migrating to the network-security-config xml) shows me the same sha256, so it's 100% correct.
Does anybody know what is going on? :)
From your first answer it is likely your certificate isn't supported by the default root CAs. Test on ssllabs.com/ssltest and see what it says for Android.
As you confirmed, the server isn't sending a complete chain to the root, so the missing intermediate is causing a failure. Some other clients will download the missing cert in this case, but not Android.