gpt4 book ai didi

android - 使用 robospice-retrofit 和 getstream.io 时没有这样的方法错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:41:56 24 4
gpt4 key购买 nike

在我们的项目中,我们正在使用com.octo.android.robospice:robospice-retrofit:1.4.14 ,需要 okhttp: 1.6.0

获取stream 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.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:811)

如果我从流库中排除 2.2.0 版本。它给出以下错误,因为该方法在 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.access$1600(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)

我需要使用这两个库,现在应该怎么办?,感谢您的支持

最佳答案

我们通过使用来自 @mykolaj 的 retrofit2 支持依赖项的非官方 robospice 来解决它。您可以在下面的链接中找到解决方案

https://github.com/stephanenicolas/robospice/issues/469

关于android - 使用 robospice-retrofit 和 getstream.io 时没有这样的方法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43938571/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com