title: Retrofit 2 unable to resolve host
body: <p>In my previous version of my app I used Apache Client and everything worked and still works. But we decided to move to Retrofit because of some performance gain. The problem is that I get "Unable to resolve host "xxxxxx": No address associated with hostname" every time. </p>
  
  <p>I put this inside manifest</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  </code></pre>
  
  <p>May there be anything else I forgot? </p>
  
  <p>This is url: <a href="https://www.hbapimanager.azure-api.net/Wallet/CheckNumber" rel="nofollow">https://www.hbapimanager.azure-api.net/Wallet/CheckNumber</a></p>
  
  <p>P.S. I have been struggling with this for almost a week </p>
  
  <p><strong>Edited</strong>: This is my retrofitFactory class:</p>
  
  <pre><code>private static HttpLoggingInterceptor logging = new HttpLoggingInterceptor()
          .setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE);
  
  private static OkHttpClient.Builder httpClient = new OkHttpClient.Builder()
          .addInterceptor(logging);
  
  private static HttpUrl url = new HttpUrl.Builder()
          .scheme("https")
          .host(Constants.Network.HOST)
          .build();
  
  private static Retrofit.Builder builder =
          new Retrofit.Builder()
                  .baseUrl(url)
                  .addConverterFactory(GsonConverterFactory.create());
  
  public static &lt;T&gt; T createRetrofitService(final Class&lt;T&gt; clazz) {
      Retrofit retrofit = builder.client(httpClient.build()).build();
      return retrofit.create(clazz);
  }
  </code></pre>
  
  <p>And this is interface for requests</p>
  
  <pre><code>    @Headers({
          Constants.Network.HEADER_TYPE,
          Constants.Network.HEADER_KEY
  })
  @POST(Constants.Network.CHECK_NUMBER)
  Call&lt;StatusData&gt; postCheckNumber(@Body CheckNumberPoRD checkNumberPoRD);
  
  @Headers({
          Constants.Network.HEADER_TYPE,
          Constants.Network.HEADER_KEY
  })
  @GET(Constants.Network.CHECK_NUMBER)
  Call&lt;CheckNumberGRD&gt; getCheckNumber(
          @Query("PrimaryKey") String primaryKey,
          @Query("RowKey") String rowKey
  );
  </code></pre>
  
  <p>And i get </p>
  
  <pre><code>09-06 16:58:50.958 7229-7283/kz.halykbank.halykewallet D/OkHttp: --&gt; POST https://www.hbapimanager.azure-api.net/Wallet/CheckNumber http/1.1
  09-06 16:58:50.959 7229-7283/kz.halykbank.halykewallet D/OkHttp: Content-   Type: application/json
  09-06 16:58:50.959 7229-7283/kz.halykbank.halykewallet D/OkHttp: Content-Length: 27
  09-06 16:58:50.959 7229-7283/kz.halykbank.halykewallet D/OkHttp: Ocp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxxxxxxx
  09-06 16:58:50.959 7229-7283/kz.halykbank.halykewallet D/OkHttp: {"phone":"x(xxx)xxx-xx-xx"}
  09-06 16:58:50.959 7229-7283/kz.halykbank.halykewallet D/OkHttp: --&gt; END POST (27-byte body)
  09-06 16:58:51.666 7229-7283/kz.halykbank.halykewallet D/OkHttp: &lt;-- HTTP FAILED: java.net.UnknownHostException: Unable to resolve host "www.hbapimanager.azure-api.net": No address associated with hostname
  </code></pre>