Android - NewRelic / Retrofit - 每次请求都有okhttp错误

时间:2015-06-09 01:40:28

标签: android retrofit newrelic

我使用New Relict com.newrelic.agent.android:android-agent:5.1.0,5.1.1或5.0.0以及retrogit 1.9获得此例!我在哪里可以报告新遗物中的错误?有同样问题的人吗?

java.lang.IllegalAccessError: Method 'void com.squareup.okhttp.Call.(com.squareup.okhttp.OkHttpClient, com.squareup.okhttp.Request)' is inaccessible to class 'com.newrelic.agent.android.instrumentation.okhttp2.CallExtension' (declaration of 'com.newrelic.agent.android.instrumentation.okhttp2.CallExtension' appears in /data/app/com.thepickupnetwork.customer.app-2/base.apk)
at com.newrelic.agent.android.instrumentation.okhttp2.CallExtension.(CallExtension.java:32)
at com.newrelic.agent.android.instrumentation.okhttp2.OkHttp2Instrumentation.newCall(OkHttp2Instrumentation.java:28)
at retrofit.client.OkClient.execute(OkClient.java:53)
at com.newrelic.agent.android.instrumentation.retrofit.ClientExtension.execute(ClientExtension.java:42)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at retrofit.Platform$Android$2$1.run(Platform.java:142)
at java.lang.Thread.run(Thread.java:818)

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。基本上我的解决方案是将okhttp从版本2.4.0降级到2.2.0。它看起来像新文库中的一个错误。看看这里:https://github.com/square/okhttp/issues/1680

答案 1 :(得分:0)

2.4中OkHttp Call构造函数范围的变化会破坏我们的工具。对此的修复已合并到OkHttp中,将在版本2.5中修复:https://github.com/square/okhttp/pull/1687

同时,两个解决方法是使用OkHttp 2.3或使用Sonatype快照存储库中的2.5.0-SNAPSHOT,如下所示:

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    ....
    compile 'com.squareup.okhttp:okhttp:2.5.0-SNAPSHOT'
    ....

来源:https://discuss.newrelic.com/t/bug-with-okhttp/25893