我在尝试访问FullContact应用编程接口服务器时遇到此错误。我使用的是okhttp 2.7.5和okhttp-urlconnection 2.7.5以及1.9.0。
Caused by: java.lang.NoSuchMethodError: com.squareup.okhttp.internal.Internal.getHttpUrlChecked(Ljava/lang/String;)Lcom/squareup/okhttp/HttpUrl;
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.newHttpEngine(HttpURLConnectionImpl.java:339)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.initHttpEngine(HttpURLConnectionImpl.java:324)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:392)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:527)
at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
at com.fullcontact.api.libs.fullcontact4j.http.FCUrlClient.readResponse(FCUrlClient.java:148)
at com.fullcontact.api.libs.fullcontact4j.http.FCUrlClient.execute(FCUrlClient.java:91)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
... 7 more发布于 2016-10-08 18:17:04
只有当用于代码编译的库/jars的版本与用于运行时执行依赖项的版本不兼容时,才会出现此问题。
确保你在两个地方都有正确的版本。
也有可能是您通过显式添加库jars来编译源代码。但是在运行时,服务器从不同版本的jar加载库类,该jar没有所需的方法。
https://stackoverflow.com/questions/39931128
复制相似问题