使用 robospice-retrofit 和 getstream.io 时没有这样的方法错误
No such method error while using robospice-retrofit and getstream.io
在我们的项目中我们正在使用
com.octo.android.robospice:robospice-retrofit:1.4.14 ,需要 okhttp: 1.6.0
并获取流java客户端
io.getstream.client:stream-repo-okhttp:1.2.2', 需要 okhttp:2.2.0
所以这里 gradle 开始使用 2.2.0 并给出以下错误,因为该方法在 2.2.0
中不可用
java.lang.NoSuchMethodError: No virtual method open(Ljava/net/URL;)Ljava/net/HttpURLConnection; in class Lcom/squareup/okhttp/OkHttpClient; or its super classes (declaration of 'com.squareup.okhttp.OkHttpClient' appears in /data/app/com.#########.apk)
at com.squareup.okhttp.OkUrlFactory.open(OkUrlFactory.java:44)
at retrofit.client.OkClient.openConnection(OkClient.java:45)
at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:36)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
at retrofit.RestAdapter$RestHandler.access0(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler.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.run(Platform.java:142)
at java.lang.Thread.run(Thread.java:811)
如果我从流中排除 2.2.0 版本 library.It 给出以下错误,因为该方法在 1.6.0
中不可用
java.lang.NoSuchMethodError: No virtual method setWriteTimeout(JLjava/util/concurrent/TimeUnit;)V in class Lcom/squareup/okhttp/OkHttpClient; or its super classes (declaration of 'com.squareup.okhttp.OkHttpClient' appears in /data/app/co.ibhubs.startup.alpha-1/base.apk)
at io.getstream.client.okhttp.repo.StreamRepoFactoryImpl.initClient(StreamRepoFactoryImpl.java:45)
at io.getstream.client.okhttp.repo.StreamRepoFactoryImpl.newInstance(StreamRepoFactoryImpl.java:38)
at io.getstream.client.okhttp.StreamClientImpl.<init>(StreamClientImpl.java:29)
at com.ibtspl.startup.utils.Application.onCreate(Application.java:47)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4726)
at android.app.ActivityThread.access00(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
我需要同时使用libraries.What现在应该怎么办?,感谢您的支持
我们通过使用来自 @mykolaj 的 retrofit2 支持依赖项的非官方 robospice 解决了这个问题。您可以在下面找到解决方案 link
在我们的项目中我们正在使用 com.octo.android.robospice:robospice-retrofit:1.4.14 ,需要 okhttp: 1.6.0
并获取流java客户端
io.getstream.client:stream-repo-okhttp:1.2.2', 需要 okhttp:2.2.0 所以这里 gradle 开始使用 2.2.0 并给出以下错误,因为该方法在 2.2.0
中不可用java.lang.NoSuchMethodError: No virtual method open(Ljava/net/URL;)Ljava/net/HttpURLConnection; in class Lcom/squareup/okhttp/OkHttpClient; or its super classes (declaration of 'com.squareup.okhttp.OkHttpClient' appears in /data/app/com.#########.apk)
at com.squareup.okhttp.OkUrlFactory.open(OkUrlFactory.java:44)
at retrofit.client.OkClient.openConnection(OkClient.java:45)
at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:36)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
at retrofit.RestAdapter$RestHandler.access0(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler.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.run(Platform.java:142)
at java.lang.Thread.run(Thread.java:811)
如果我从流中排除 2.2.0 版本 library.It 给出以下错误,因为该方法在 1.6.0
中不可用java.lang.NoSuchMethodError: No virtual method setWriteTimeout(JLjava/util/concurrent/TimeUnit;)V in class Lcom/squareup/okhttp/OkHttpClient; or its super classes (declaration of 'com.squareup.okhttp.OkHttpClient' appears in /data/app/co.ibhubs.startup.alpha-1/base.apk)
at io.getstream.client.okhttp.repo.StreamRepoFactoryImpl.initClient(StreamRepoFactoryImpl.java:45)
at io.getstream.client.okhttp.repo.StreamRepoFactoryImpl.newInstance(StreamRepoFactoryImpl.java:38)
at io.getstream.client.okhttp.StreamClientImpl.<init>(StreamClientImpl.java:29)
at com.ibtspl.startup.utils.Application.onCreate(Application.java:47)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4726)
at android.app.ActivityThread.access00(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
我需要同时使用libraries.What现在应该怎么办?,感谢您的支持
我们通过使用来自 @mykolaj 的 retrofit2 支持依赖项的非官方 robospice 解决了这个问题。您可以在下面找到解决方案 link