title: NoSuchMethodError: okhttp3.HttpUrl.get(Ljava/lang/String;)Lokhttp3/HttpUrl when using retrofit 2
body: <p>I am using retrofit 2 to send a http request, code like this:</p>
  <pre><code>            ReconcileService service = RetrofitUtil.InitRetrofitOkhttp().create(ReconcileService.class);
              Call&lt;ResponseBody&gt; call = service.page(request);
              ResponseBody body = call.execute().body();
              String str = new String(body.bytes(), &quot;UTF-8&quot;);
              ObjectMapper mapper = new ObjectMapper();
              Response response = mapper.readValue(str, Response.class);
  </code></pre>
  <p>this is the retrofit initial code:</p>
  <pre><code>public static Retrofit InitRetrofitOkhttp() {
          OkHttpClient.Builder builder = new OkHttpClient.Builder();
          builder.connectTimeout(10, TimeUnit.SECONDS);
          builder.readTimeout(20, TimeUnit.SECONDS);
          builder.writeTimeout(20, TimeUnit.SECONDS);
          builder.retryOnConnectionFailure(true);
          Config config = ConfigService.getAppConfig();
          String baseUrl = config.getProperty(&quot;robot.retrofit.base-url&quot;, &quot;127.0.0.1&quot;);
          OkHttpClient client = builder.build();
          Retrofit.Builder retrofitBuilder = new Retrofit.Builder();
          retrofitBuilder.client(client);
          retrofitBuilder.baseUrl(baseUrl);
          Retrofit sRetrofit = retrofitBuilder.build();
          return sRetrofit;
      }
  </code></pre>
  <p>but when running this code, it give me tips:</p>
  <pre><code>    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
  Caused by: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: okhttp3.HttpUrl.get(Ljava/lang/String;)Lokhttp3/HttpUrl;
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) [spring-webmvc-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]
      ... 55 common frames omitted
  Caused by: java.lang.NoSuchMethodError: okhttp3.HttpUrl.get(Ljava/lang/String;)Lokhttp3/HttpUrl;
      at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:492) ~[retrofit-2.8.1.jar!/:na]
      at com.sportswin.soa.misc.biz.common.RetrofitUtil.InitRetrofitOkhttp(RetrofitUtil.java:42) ~[soa-misc-biz-1.0.0-SNAPSHOT.jar!/:na]
      at com.sportswin.soa.illidan.controller.impl.tenant.ReconcilationController.getRes(ReconcilationController.java:38) ~[classes!/:na]
      at com.sportswin.soa.illidan.controller.impl.tenant.ReconcilationController.tenantPage(ReconcilationController.java:31) ~[classes!/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) [spring-web-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]
  </code></pre>
  <p>I try to find answer from internet but all told to upgrade the okhttp version. But now my okhttp version already 4.0, this is my gradle config:</p>
  <pre><code>api(&quot;com.squareup.okhttp3:okhttp:4.0.0&quot;)
  api &quot;com.squareup.retrofit2:converter-gson:2.8.1&quot;
  </code></pre>
  <p>so where is the problem and what should I do to fix it?</p>