title: Android - Retrofit : java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
body: <p>I'm trying to call an API on my personal Backend server and I get this SSL error in response.</p>
  
  <p>How can I ask Retrofit to ignore SSL errors ?</p>
  
  <p>Thanks,</p>
  
  <pre><code>2019-07-17 15:43:33.385 31394-31394/com.test E/com.test.site.ui.SiteFragment: getSitesList() - onFailure() Could not load sites list: 
      javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
          at com.android.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(ConscryptFileDescriptorSocket.java:229)
          at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:351)
          at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:310)
          at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:178)
          at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:236)
          at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:109)
  </code></pre>
  
  <p>App.kt:</p>
  
  <pre><code>package com.test
  
  import android.app.Application
  import com.test.site.service.SiteService
  import okhttp3.OkHttpClient
  import okhttp3.logging.HttpLoggingInterceptor
  import retrofit2.Retrofit
  import retrofit2.converter.gson.GsonConverterFactory
  
  
  class App : Application() {
  
      companion object {
  
          lateinit var instance: App
  
          // Create interceptor to get HTTP logs
          private val httpClient = OkHttpClient.Builder()
              .addInterceptor(HttpLoggingInterceptor())
              .build();
  
          // Create retrofit instance for whole application
          private val retrofit = Retrofit.Builder()
              .client(httpClient)
              .baseUrl("https://api.mydomain.com/")
              .addConverterFactory(GsonConverterFactory.create())
              .build()
  
          // Create siteService
          val siteService: SiteService = retrofit.create(SiteService::class.java)
  
      }
  
      override fun onCreate() {
          super.onCreate()
          instance = this
      }
  
  
  }
  </code></pre>