Android库依赖冲突

问题描述 投票:0回答:0

我正在为我的公司构建一个 android 库。该库执行一些网络调用,而 Retrofit 库正用于该目的。我已成功构建库并托管在私有 Maven 存储库中。当我将库包含在我的一个应用程序中时,该应用程序也使用 Retrofit 库进行网络调用,我收到此错误

java.lang.NoSuchFieldError: No field Companion of type Lokhttp3/internal/platform/Platform$Companion; in class Lokhttp3/internal/platform/Platform; or its superclasses (declaration of 'okhttp3.internal.platform.Platform'

我读到这个错误,这是因为我的库和应用程序都使用 Retrofit 但版本不同。我显然可以通过应用 resolutionStrategy.force 为我的应用程序修复此问题,但我真正的问题是这个问题实际上是如何在生产库中修复的,因为很快我们就会有一些客户使用该库。我在谷歌上搜索了很多但找不到任何初学者可以理解的解决方案。

android retrofit android-library aar
© www.soinside.com 2019 - 2024. All rights reserved.