title: Android Emulator "Chain Validation Failed" connecting developers machine with self-signed cert
body: <p>I have an Android Studio project that calls a web based API service. When the service code is in dev, qa, prod etc. There are NO certificate issues but when trying to hit the web api developers box to test a new feature / bug fix / etc. I get:</p>
  <blockquote>
  <p>No reply because of error:</p>
  <p>javax.net.ssl.SSLHandshakeException: Chain validation failed</p>
  <p>at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:361)</p>
  </blockquote>
  <p>I had the self signed certificate exported from the service developers machine WITHOUT the private key DER encoded. I dropped onto the emulator and it &quot;installed&quot; but this did not work.</p>
  <p>I took the same cert above and copied to the emulated sd card. Then installed from security settings in emulator. Same result. Chain validation failed.</p>
  <p>Now my security / certificate knowledge is very basic. I think the error actually describes the problem. There is no chain in a self signed certificate...but I could be wrong.</p>
  <p>Regardless, how do I work around this?</p>
  <p>I desire to be able to run my Android code and hit the developers box for testing / debugging etc.</p>
  <p>I have read post like this one only to have the corporate environment I am in blocking the sites for open SSL etc.</p>
  <p><a href="https://android.stackexchange.com/questions/61540/self-signed-certificate-install-claims-success-but-android-acts-as-if-cert-isn">https://android.stackexchange.com/questions/61540/self-signed-certificate-install-claims-success-but-android-acts-as-if-cert-isn</a></p>
  <p>I am accessing the service through a WebView.</p>