While pinning in general should _never_ be encouraged, as it actively harms the security and stability of the Internet at large, if you're pinning to a private CA, Android's Network Security Config (
https://developer.android.com/training/articles/security-config ) is the preferred approach.
Is there a reason this doesn't work for you?
Note: you should not pin: to CA, to server cert, to intermediate - unless it's to a CA your organization controls and a trust store you maintain (e.g. via Security Config). Any other pinning (e.g. relying on the OS CAs) is inherently insecure and harmful.