2

I'm trying to use in my application a third-party library that wraps Loggly(logging web service).

I used all over my app Retrofit2 but all of the third-party libs that wrap Loggly use the old Retrofit 1.9.0.

Now, I'm keep getting ClassNotFoundException from these libs because they are trying to access a class that only exists in Retrofit 1.9.0 and not in 2.0.0.

I'm trying to solve it in a straightforward way - adding both Retrofit 1.9.0 and Retrofit 2.0.0 to my project but unfortunately gradle doesn't seems to support this.

So the problem here is how to add two different versions of the same library to your build.gradle file

4

1 回答 1

1

也许您应该为 loggly 服务创建一个新模块并通过接口访问它。这意味着您的主应用程序仍将依赖于改造 2,并且带有 loggly 的新模块将拥有自己的带有改造 1 的 gradle 构建。

在我们的应用程序中,我们使用表示 - 域 (MVC) 结构。这意味着网络在它自己的模块中,这意味着我们可能有一个改造 1 和改造 2 模块,它们有自己的实现、接口和它所依赖的 gradle 依赖项。域层然后引用这些模块。

很高兴我能帮上忙!。

于 2016-03-08T09:49:43.947 回答